diff --git a/.sync.sh b/.sync.sh index 06e85a5..c184cb1 100644 --- a/.sync.sh +++ b/.sync.sh @@ -1,9 +1,9 @@ -url="https://api.powerbi.com/beta/72f988bf-86f1-41af-91ab-2d7cd011db47/datasets/f56a3240-7d0c-45aa-a694-65ebf6a04cc2/rows?key=RHtUJLk6Vi7QIlOBAPENJuCHOT6WbVdBi%2Fa%2BhwoDFpaOFhTsPH8zXWE%2F%2FFSjPdxF7Lmkf%2Fl1q2nLgBYk7HYqUQ%3D%3D" -build_time=`date +%Y-%m-%dT%H:%M:%S` +url="https://api.powerbi.com/beta/72f988bf-86f1-41af-91ab-2d7cd011db47/datasets/2ff1e8a8-2f6f-4d73-a75d-86829e3f4574/rows?key=8f5xLp1gP8%2FzSee4vCUBcyjR65I9zZ6nb%2B%2F7bbzex%2FSctLX3ntIlAR0sxWpDdguuYyDtLdHK%2Fxbxj%2FrSBkX7eQ%3D%3D" +build_time=`date +%Y-%m-%dT%H:%M:%S.000+0800` device_info=`uname -s -n -m` curl --include --request POST --header "Content-Type: application/json" --data-binary "[{ -\"Build time\" :\"$build_time\", -\"Device info\" :\"$device_info\", -\"Project info\" :\"$1\", -\"Weight\" :1 +\"device_info\" :\"$device_info\", +\"project_info\" :\"$1\", +\"time\" :\"$build_time\", +\"weight\" :1 }]" $url diff --git a/README.md b/README.md index 63e99bb..b8953ee 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # GuiLite - 简洁出奇迹 -- GuiLite(超轻量UI框架)是6千行代码的**全平台UI框架**,可以完美运行在iOS,Android,Windows(包含VR),Mac,单片机*和市面所有的 ARM Linux物联网终端设备上。 +- GuiLite(超轻量UI框架)是6千行代码的**全平台UI框架**,可以完美运行在iOS,Android,Windows(包含VR),Mac,单片机和**市面所有的 ARM Linux物联网终端设备**上。 - GuiLite可以嵌入在iOS、Android、MFC、QT等其他UI系统中,让你的界面集百家之长,又不失个性。 - GuiLite鼓励混合编程,开发者可以用GuiLite接管UI部分,用Swift,Java,Go,C#,Python发开业务部分。 diff --git a/core/core_include/api.h b/core/core_include/api.h index 2029404..90e171b 100644 --- a/core/core_include/api.h +++ b/core/core_include/api.h @@ -15,13 +15,15 @@ void do_assert(const char* file, int line); void log_out(const char* log); -#define COLOR_TRANPARENT 0xFF000000 -#define GLT_RGB(r, g, b) ((0xFF << 24) | (((unsigned int)(r)) << 16) | (((unsigned int)(g)) << 8) | ((unsigned int)(b))) -#define GLT_RGB_R(rgb) ((((unsigned int)(rgb)) >> 16) & 0xFF) -#define GLT_RGB_G(rgb) ((((unsigned int)(rgb)) >> 8) & 0xFF) -#define GLT_RGB_B(rgb) (((unsigned int)(rgb)) & 0xFF) -#define GLT_RGB_32_to_16(rgb) (((((unsigned int)(rgb)) & 0xFF) >> 3) | ((((unsigned int)(rgb)) & 0xFC00) >> 5) | ((((unsigned int)(rgb)) & 0xF80000) >> 8)) -#define GLT_RGB_16_to_32(rgb) (((((unsigned int)(rgb)) & 0x1F) << 3) | ((((unsigned int)(rgb)) & 0x7E0) << 5) | ((((unsigned int)(rgb)) & 0xF800) << 8)) +#define GL_ARGB(a, r, g, b) ((((unsigned int)(a)) << 24) | (((unsigned int)(r)) << 16) | (((unsigned int)(g)) << 8) | ((unsigned int)(b))) +#define GL_ARGB_A(rgb) ((((unsigned int)(rgb)) >> 24) & 0xFF) + +#define GL_RGB(r, g, b) ((0xFF << 24) | (((unsigned int)(r)) << 16) | (((unsigned int)(g)) << 8) | ((unsigned int)(b))) +#define GL_RGB_R(rgb) ((((unsigned int)(rgb)) >> 16) & 0xFF) +#define GL_RGB_G(rgb) ((((unsigned int)(rgb)) >> 8) & 0xFF) +#define GL_RGB_B(rgb) (((unsigned int)(rgb)) & 0xFF) +#define GL_RGB_32_to_16(rgb) (((((unsigned int)(rgb)) & 0xFF) >> 3) | ((((unsigned int)(rgb)) & 0xFC00) >> 5) | ((((unsigned int)(rgb)) & 0xF80000) >> 8)) +#define GL_RGB_16_to_32(rgb) (((((unsigned int)(rgb)) & 0x1F) << 3) | ((((unsigned int)(rgb)) & 0x7E0) << 5) | ((((unsigned int)(rgb)) & 0xF800) << 8)) typedef struct _T_TIME { diff --git a/core/core_include/resource.h b/core/core_include/resource.h index 92bdc3e..7690b45 100644 --- a/core/core_include/resource.h +++ b/core/core_include/resource.h @@ -28,7 +28,7 @@ typedef struct struct_font_info //SHAPE #define INVALID_RGN 0xFFFFFF -#define COLOR_USERDEF GLT_RGB(41,49,49) +#define COLOR_USERDEF GL_RGB(41,49,49) typedef struct struct_color_rect { int l; diff --git a/core/core_include/surface.h b/core/core_include/surface.h index 0e53c39..fb59975 100644 --- a/core/core_include/surface.h +++ b/core/core_include/surface.h @@ -21,10 +21,10 @@ class c_display; class c_surface { friend class c_display; public: - virtual void set_pixel(int x, int y, unsigned int rgb, unsigned int z_order); - virtual unsigned int get_pixel(int x, int y, unsigned int z_order); + virtual void draw_pixel(int x, int y, unsigned int rgb, unsigned int z_order); virtual void fill_rect(int x0, int y0, int x1, int y1, unsigned int rgb, unsigned int z_order); void fill_rect_ex(int l, int t, int r, int b, unsigned int color, const COLOR_RECT* extend_rects, int z_order); + virtual unsigned int get_pixel(int x, int y, unsigned int z_order); int get_width() { return m_width; } int get_height() { return m_height; } @@ -41,8 +41,8 @@ public: int set_frame_layer(c_rect& rect, unsigned int z_order); void set_active(bool flag){m_is_active = flag;} protected: - virtual void set_pixel_on_fb(int x, int y, unsigned int rgb); virtual void fill_rect_on_fb(int x0, int y0, int x1, int y1, unsigned int rgb); + virtual void set_pixel(int x, int y, unsigned int rgb); void set_surface(void* wnd_root, Z_ORDER_LEVEL max_z_order); int copy_layer_pixel_2_fb(int x, int y, unsigned int z_order); @@ -64,10 +64,11 @@ class c_surface_16bits : public c_surface { friend class c_display; c_surface_16bits(c_display* display, void* phy_fb, unsigned int width, unsigned int height, unsigned int color_bytes) : c_surface(display, phy_fb, width, height, color_bytes) {}; - virtual void set_pixel(int x, int y, unsigned int rgb, unsigned int z_order); - virtual void set_pixel_on_fb(int x, int y, unsigned int rgb); + virtual void draw_pixel(int x, int y, unsigned int rgb, unsigned int z_order); virtual void fill_rect(int x0, int y0, int x1, int y1, unsigned int rgb, unsigned int z_order); virtual void fill_rect_on_fb(int x0, int y0, int x1, int y1, unsigned int rgb); virtual unsigned int get_pixel(int x, int y, unsigned int z_order); +protected: + virtual void set_pixel(int x, int y, unsigned int rgb); }; #endif diff --git a/core/core_include/wave_ctrl.h b/core/core_include/wave_ctrl.h index fd823d1..c400feb 100644 --- a/core/core_include/wave_ctrl.h +++ b/core/core_include/wave_ctrl.h @@ -47,8 +47,8 @@ public: protected: void draw_smooth_vline(int y_min, int y_max, int mid, unsigned int rgb); - void erase_oldest_vline(); - void save_foreground(); + void restore_background(); + void save_background(); char* m_wave_name; char* m_wave_unit; @@ -74,7 +74,7 @@ protected: private: c_wave_buffer* m_wave; - void* m_bg_fb; //background frame buffer, could be used to draw scale line. + unsigned int* m_bg_fb; //background frame buffer, could be used to draw scale line. int m_wave_cursor; int m_wave_speed; //pixels per refresh int m_wave_sample_rate; diff --git a/core/core_include/wnd.h b/core/core_include/wnd.h index 4f296a1..07f391c 100644 --- a/core/core_include/wnd.h +++ b/core/core_include/wnd.h @@ -121,7 +121,7 @@ protected: virtual void on_focus(); virtual void on_kill_focus(); - void set_pixel(int x, int y, unsigned int rgb); + void draw_pixel(int x, int y, unsigned int rgb); void draw_hline(int x0, int x1, int y, unsigned int rgb); void draw_vline(int x, int y0, int y1, unsigned int rgb); void draw_line(int x0, int y0, int x1, int y1, unsigned int rgb); diff --git a/core/src/bitmap.cpp b/core/src/bitmap.cpp index 4206837..2aba491 100644 --- a/core/src/bitmap.cpp +++ b/core/src/bitmap.cpp @@ -96,7 +96,7 @@ void c_bitmap::draw_bitmap_565(c_surface* surface, int z_order, int x, int y, in for (int i = 0; i < xsize; i++) { unsigned int rgb = *p++; - surface->set_pixel(x + i, y + j, GLT_RGB_16_to_32(rgb), z_order); + surface->draw_pixel(x + i, y + j, GL_RGB_16_to_32(rgb), z_order); } pData += BytesPerLine; } @@ -120,7 +120,7 @@ void c_bitmap::draw_bitmap_565_inrect(c_surface* surface, int z_order, int x, in } unsigned int rgb = *p++; - surface->set_pixel(x + i, y + j, GLT_RGB_16_to_32(rgb), z_order); + surface->draw_pixel(x + i, y + j, GL_RGB_16_to_32(rgb), z_order); } pData += BytesPerLine; } diff --git a/core/src/display.cpp b/core/src/display.cpp index e2b16aa..da35645 100644 --- a/core/src/display.cpp +++ b/core/src/display.cpp @@ -169,7 +169,7 @@ int c_display::snap_shot(unsigned int display_id) for (int i = 0; i < width * height; i++) { unsigned int rgb = *p_raw_data++; - p_bmp565_data[i] = GLT_RGB_32_to_16(rgb); + p_bmp565_data[i] = GL_RGB_32_to_16(rgb); } int ret = build_bmp(path, width, height, (unsigned char*)p_bmp565_data); diff --git a/core/src/surface.cpp b/core/src/surface.cpp index 7d24c6f..ff4d21b 100644 --- a/core/src/surface.cpp +++ b/core/src/surface.cpp @@ -34,7 +34,7 @@ void c_surface::set_surface(void* wnd_root, Z_ORDER_LEVEL max_z_order) } } -void c_surface::set_pixel(int x, int y, unsigned int rgb, unsigned int z_order) +void c_surface::draw_pixel(int x, int y, unsigned int rgb, unsigned int z_order) { if (x >= m_width || y >= m_height || x < 0 || y < 0) { @@ -59,14 +59,14 @@ void c_surface::set_pixel(int x, int y, unsigned int rgb, unsigned int z_order) if (z_order == m_max_zorder) { - return set_pixel_on_fb(x, y, rgb); + return set_pixel(x, y, rgb); } ((unsigned int*)(m_frame_layers[z_order].fb))[x + y * m_width] = rgb; if (z_order == m_top_zorder) { - return set_pixel_on_fb(x, y, rgb); + return set_pixel(x, y, rgb); } bool is_covered = false; @@ -81,11 +81,11 @@ void c_surface::set_pixel(int x, int y, unsigned int rgb, unsigned int z_order) if (!is_covered) { - set_pixel_on_fb(x, y, rgb); + set_pixel(x, y, rgb); } } -void c_surface::set_pixel_on_fb(int x, int y, unsigned int rgb) +void c_surface::set_pixel(int x, int y, unsigned int rgb) { ((unsigned int*)m_fb)[y * m_width + x] = rgb; @@ -180,7 +180,7 @@ void c_surface::draw_hline(int x0, int x1, int y, unsigned int rgb, unsigned int for (;x0 <= x1; x0++) { - set_pixel(x0, y, rgb, z_order); + draw_pixel(x0, y, rgb, z_order); } } @@ -193,7 +193,7 @@ void c_surface::draw_vline(int x, int y0, int y1, unsigned int rgb, unsigned int for (;y0 <= y1; y0++) { - set_pixel(x, y0, rgb, z_order); + draw_pixel(x, y0, rgb, z_order); } } @@ -210,7 +210,7 @@ void c_surface::draw_line(int x1, int y1, int x2, int y2, unsigned int rgb, unsi e = dy - dx / 2; for(; x1 <= x2; x1++, e += dy) { - set_pixel(x1, y1, rgb, z_order); + draw_pixel(x1, y1, rgb, z_order); if (e>0) { y1++; e -= dx; } } } @@ -219,7 +219,7 @@ void c_surface::draw_line(int x1, int y1, int x2, int y2, unsigned int rgb, unsi e = dx - dy / 2; for(; y1 <= y2; y1++, e += dx) { - set_pixel(x1, y1, rgb, z_order); + draw_pixel(x1, y1, rgb, z_order); if (e>0) { x1++; e -= dy; } } } @@ -233,7 +233,7 @@ void c_surface::draw_line(int x1, int y1, int x2, int y2, unsigned int rgb, unsi e = dy - dx / 2; for(; x1 <= x2; x1++, e += dy) { - set_pixel(x1, y1, rgb, z_order); + draw_pixel(x1, y1, rgb, z_order); if (e>0) { y1--; e -= dx; } } } @@ -242,7 +242,7 @@ void c_surface::draw_line(int x1, int y1, int x2, int y2, unsigned int rgb, unsi e = dx - dy / 2; for(; y1 >= y2; y1--, e += dx) { - set_pixel(x1, y1, rgb, z_order); + draw_pixel(x1, y1, rgb, z_order); if (e>0) { x1++; e -= dy; } } } @@ -256,7 +256,7 @@ void c_surface::draw_line(int x1, int y1, int x2, int y2, unsigned int rgb, unsi e = dy - dx / 2; for(; x1 >= x2; x1--, e += dy) { - set_pixel(x1, y1, rgb, z_order); + draw_pixel(x1, y1, rgb, z_order); if (e>0) { y1++; e -= dx; } } } @@ -265,7 +265,7 @@ void c_surface::draw_line(int x1, int y1, int x2, int y2, unsigned int rgb, unsi e = dx - dy / 2; for(; y1 <= y2; y1++, e += dx) { - set_pixel(x1, y1, rgb, z_order); + draw_pixel(x1, y1, rgb, z_order); if (e>0) { x1--; e -= dy; } } } @@ -280,7 +280,7 @@ void c_surface::draw_line(int x1, int y1, int x2, int y2, unsigned int rgb, unsi e = dy - dx / 2; for(; x1 >= x2; x1--, e += dy) { - set_pixel(x1, y1, rgb, z_order); + draw_pixel(x1, y1, rgb, z_order); if (e>0) { y1--; e -= dx; } } } @@ -290,7 +290,7 @@ void c_surface::draw_line(int x1, int y1, int x2, int y2, unsigned int rgb, unsi while (y1-- >= y2) for(; y1 >= y2; y1--, e += dx) { - set_pixel(x1, y1, rgb, z_order); + draw_pixel(x1, y1, rgb, z_order); if (e>0) { x1--; e -= dy; } } } @@ -402,7 +402,7 @@ void c_surface::fill_rect_ex(int l, int t, int r, int b, unsigned int color, con { for(int x = templ; x <= tempr; x++) { - set_pixel(x , y, tempcolor, z_order); + draw_pixel(x , y, tempcolor, z_order); } } } @@ -453,7 +453,7 @@ bool c_surface::is_valid(c_rect rect) } ////////////////////////////////////////////////////////////////////////////////////// -void c_surface_16bits::set_pixel(int x, int y, unsigned int rgb, unsigned int z_order) +void c_surface_16bits::draw_pixel(int x, int y, unsigned int rgb, unsigned int z_order) { if (x >= m_width || y >= m_height || x < 0 || y < 0) { @@ -476,17 +476,17 @@ void c_surface_16bits::set_pixel(int x, int y, unsigned int rgb, unsigned int z_ return; } - rgb = GLT_RGB_32_to_16(rgb); + rgb = GL_RGB_32_to_16(rgb); if (z_order == m_max_zorder) { - return set_pixel_on_fb(x, y, rgb); + return set_pixel(x, y, rgb); } ((unsigned short*)(m_frame_layers[z_order].fb))[x + y * m_width] = rgb; if (z_order == m_top_zorder) { - return set_pixel_on_fb(x, y, rgb); + return set_pixel(x, y, rgb); } bool is_covered = false; @@ -501,11 +501,11 @@ void c_surface_16bits::set_pixel(int x, int y, unsigned int rgb, unsigned int z_ if (!is_covered) { - set_pixel_on_fb(x, y, rgb); + set_pixel(x, y, rgb); } } -void c_surface_16bits::set_pixel_on_fb(int x, int y, unsigned int rgb) +void c_surface_16bits::set_pixel(int x, int y, unsigned int rgb) { ((unsigned short*)m_fb)[y * m_width + x] = rgb; @@ -519,10 +519,9 @@ void c_surface_16bits::set_pixel_on_fb(int x, int y, unsigned int rgb) void c_surface_16bits::fill_rect(int x0, int y0, int x1, int y1, unsigned int rgb, unsigned int z_order) { - rgb = GLT_RGB_32_to_16(rgb); if (z_order == m_max_zorder) { - return fill_rect_on_fb(x0, y0, x1, y1, rgb); + return fill_rect_on_fb(x0, y0, x1, y1, GL_RGB_32_to_16(rgb)); } if (z_order == m_top_zorder) { @@ -537,7 +536,7 @@ void c_surface_16bits::fill_rect(int x0, int y0, int x1, int y1, unsigned int rg *mem_fb++ = rgb; } } - return fill_rect_on_fb(x0, y0, x1, y1, rgb); + return fill_rect_on_fb(x0, y0, x1, y1, GL_RGB_32_to_16(rgb)); } for (; y0 <= y1; y0++) @@ -585,8 +584,8 @@ unsigned int c_surface_16bits::get_pixel(int x, int y, unsigned int z_order) if (z_order == m_max_zorder) { - return GLT_RGB_16_to_32(((unsigned short*)m_fb)[y * m_width + x]); + return GL_RGB_16_to_32(((unsigned short*)m_fb)[y * m_width + x]); } - return GLT_RGB_16_to_32(((unsigned short*)(m_frame_layers[z_order].fb))[y * m_width + x]); + return GL_RGB_16_to_32(((unsigned short*)(m_frame_layers[z_order].fb))[y * m_width + x]); } \ No newline at end of file diff --git a/core/src/wave_ctrl.cpp b/core/src/wave_ctrl.cpp index 698acf1..03daedb 100644 --- a/core/src/wave_ctrl.cpp +++ b/core/src/wave_ctrl.cpp @@ -33,8 +33,8 @@ c_wave_ctrl::c_wave_ctrl() m_gain = ZOOM_100; m_frame_len_map_index = 0; - m_wave_name_color = m_wave_unit_color = m_wave_color = GLT_RGB(255,0,0); - m_back_color = GLT_RGB(0,0,0); + m_wave_name_color = m_wave_unit_color = m_wave_color = GL_RGB(255,0,0); + m_back_color = GL_RGB(0,0,0); } void c_wave_ctrl::on_init_children() @@ -48,7 +48,7 @@ void c_wave_ctrl::on_init_children() m_wave_bottom = rect.m_bottom - 4; m_wave_cursor = m_wave_left; - m_bg_fb = calloc(rect.Width() * rect.Height(), 2); + m_bg_fb = (unsigned int*)calloc(rect.Width() * rect.Height(), 4); } void c_wave_ctrl::set_max_min_base(short max_data, short min_data, short data_base) @@ -173,7 +173,7 @@ void c_wave_ctrl::refresh_wave(unsigned char frame) CORRECT(mid, m_wave_bottom, m_wave_top); draw_smooth_vline(y_min, y_max, mid, m_wave_color); - erase_oldest_vline(); + restore_background(); //ring the wave if ((m_wave_cursor + 1) > m_wave_right) { @@ -189,13 +189,13 @@ void c_wave_ctrl::refresh_wave(unsigned char frame) void c_wave_ctrl::draw_smooth_vline(int y_min, int y_max, int mid, unsigned int rgb) { int dy = y_max - y_min; - short r = GLT_RGB_R(rgb); - short g = GLT_RGB_G(rgb); - short b = GLT_RGB_B(rgb); + short r = GL_RGB_R(rgb); + short g = GL_RGB_G(rgb); + short b = GL_RGB_B(rgb); int index = dy / 2 + 2; int y; - set_pixel(m_wave_cursor, mid, rgb); + draw_pixel(m_wave_cursor, mid, rgb); if (dy < 1) { @@ -212,8 +212,8 @@ void c_wave_ctrl::draw_smooth_vline(int y_min, int y_max, int mid, unsigned int cur_r = r*(index - i)/index; cur_g = g*(index - i)/index; cur_b = b*(index - i)/index; - cur_rgb = GLT_RGB(cur_r, cur_g, cur_b); - set_pixel(m_wave_cursor, y, cur_rgb); + cur_rgb = GL_RGB(cur_r, cur_g, cur_b); + draw_pixel(m_wave_cursor, y, cur_rgb); } if ( (mid - i) >= y_min ) { @@ -221,8 +221,8 @@ void c_wave_ctrl::draw_smooth_vline(int y_min, int y_max, int mid, unsigned int cur_r = r*(index - i)/index; cur_g = g*(index - i)/index; cur_b = b*(index - i)/index; - cur_rgb = GLT_RGB(cur_r, cur_g, cur_b); - set_pixel(m_wave_cursor, y, cur_rgb); + cur_rgb = GL_RGB(cur_r, cur_g, cur_b); + draw_pixel(m_wave_cursor, y, cur_rgb); } } } @@ -235,11 +235,11 @@ void c_wave_ctrl::on_paint() fill_rect(rect.m_left, rect.m_top, rect.m_right, rect.m_bottom, m_back_color); //show name - c_word::draw_string(m_surface, m_z_order, m_wave_name, m_wave_left + 10, rect.m_top, m_wave_name_font_type, m_wave_name_color, COLOR_TRANPARENT, ALIGN_LEFT); + c_word::draw_string(m_surface, m_z_order, m_wave_name, m_wave_left + 10, rect.m_top, m_wave_name_font_type, m_wave_name_color, GL_ARGB(0, 0, 0, 0), ALIGN_LEFT); //show unit - c_word::draw_string(m_surface, m_z_order, m_wave_unit, m_wave_left + 60, rect.m_top, m_wave_unit_font_type, m_wave_unit_color, COLOR_TRANPARENT, ALIGN_LEFT); + c_word::draw_string(m_surface, m_z_order, m_wave_unit, m_wave_left + 60, rect.m_top, m_wave_unit_font_type, m_wave_unit_color, GL_ARGB(0, 0, 0, 0), ALIGN_LEFT); - save_foreground(); + save_background(); } void c_wave_ctrl::clear_wave(void) @@ -252,9 +252,8 @@ void c_wave_ctrl::clear_wave(void) m_wave_cursor = m_wave_left; } -void c_wave_ctrl::erase_oldest_vline() +void c_wave_ctrl::restore_background() { - //earse oldest vline = draw background on foreground. int x = m_wave_cursor + WAVE_CURSOR_WIDTH; if (x > m_wave_right) { @@ -266,20 +265,20 @@ void c_wave_ctrl::erase_oldest_vline() register int width = rect.Width(); register int top = rect.m_top; register int left = rect.m_left; - unsigned short* p_fb = (unsigned short*)m_bg_fb; + unsigned int* p_fb = m_bg_fb; for (int y_pos = (m_wave_top - 1); y_pos <= (m_wave_bottom + 1); y_pos++) { - set_pixel(x, y_pos, p_fb[(y_pos - top) * width + (x - left)]); + draw_pixel(x, y_pos, p_fb[(y_pos - top) * width + (x - left)]); } } -void c_wave_ctrl::save_foreground() +void c_wave_ctrl::save_background() { c_rect rect; get_screen_rect(rect); - //copy foreground to background - register unsigned short* p_des = (unsigned short*)m_bg_fb; + + register unsigned int* p_des = m_bg_fb; for (int y = rect.m_top; y <= rect.m_bottom; y++) { for (int x = rect.m_left; x <= rect.m_right; x++) diff --git a/core/src/wnd.cpp b/core/src/wnd.cpp index e906b8d..4d701e3 100644 --- a/core/src/wnd.cpp +++ b/core/src/wnd.cpp @@ -745,9 +745,9 @@ void c_wnd::notify_parent(unsigned short msg_id, unsigned int w_param, long l_pa } } -void c_wnd::set_pixel(int x, int y, unsigned int rgb) +void c_wnd::draw_pixel(int x, int y, unsigned int rgb) { - m_surface->set_pixel(x, y, rgb, m_z_order); + m_surface->draw_pixel(x, y, rgb, m_z_order); } void c_wnd::draw_hline(int x0, int x1, int y, unsigned int rgb) diff --git a/core/src/word.cpp b/core/src/word.cpp index 6700d66..e162d57 100644 --- a/core/src/word.cpp +++ b/core/src/word.cpp @@ -9,21 +9,21 @@ #define BUFFER_LEN 16 unsigned char s_utf8_length_table[256] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1 }; @@ -92,18 +92,18 @@ void c_word::draw_string(c_surface* surface, int z_order, const char *s, int x, ASSERT(FALSE); } - int offset = 0; - unsigned int utf8_code; - while (*s) - { + int offset = 0; + unsigned int utf8_code; + while (*s) + { if (*s == '\n') { y += font->height; offset = 0; continue; - } - s += get_utf8_code(s, utf8_code); - offset += draw_single_char(surface, z_order, utf8_code, (x + offset), y, font, font_color, bg_color); + } + s += get_utf8_code(s, utf8_code); + offset += draw_single_char(surface, z_order, utf8_code, (x + offset), y, font, font_color, bg_color); } } @@ -137,24 +137,24 @@ void c_word::value_2_string(int value, int dot_position, char* buf, int len) const LATTICE* c_word::get_lattice(const FONT_INFO* font, unsigned int utf8_code) { - int first = 0; - int last = font->count - 1; - int middle = (first + last) / 2; - - while (first <= last) - { - if (font->lattice_array[middle].utf8_code < utf8_code) - first = middle + 1; - else if (font->lattice_array[middle].utf8_code == utf8_code) - { - return &font->lattice_array[middle]; - } - else - { - last = middle - 1; - } - middle = (first + last) / 2; - } + int first = 0; + int last = font->count - 1; + int middle = (first + last) / 2; + + while (first <= last) + { + if (font->lattice_array[middle].utf8_code < utf8_code) + first = middle + 1; + else if (font->lattice_array[middle].utf8_code == utf8_code) + { + return &font->lattice_array[middle]; + } + else + { + last = middle - 1; + } + middle = (first + last) / 2; + } return NULL; } @@ -178,8 +178,8 @@ int c_word::draw_single_char(c_surface* surface, int z_order, unsigned int utf8_ { for (int x_ = 0; x_ < len; x_++) { - ((y_ % 4) == 0) ? surface->set_pixel((x + x_), (y + y_), 0, z_order) : - surface->set_pixel((x + x_), (y + y_), 0xFFFFFFFF, z_order); + ((y_ % 4) == 0) ? surface->draw_pixel((x + x_), (y + y_), 0, z_order) : + surface->draw_pixel((x + x_), (y + y_), 0xFFFFFFFF, z_order); } } return len; @@ -189,7 +189,6 @@ void c_word::draw_lattice(c_surface* surface, int z_order, int x, int y, int wid const unsigned char* p_data, unsigned int font_color, unsigned int bg_color) { unsigned int r, g, b; - unsigned int bg_color_set = (COLOR_TRANPARENT == bg_color) ? surface->get_pixel(x, y, z_order) : bg_color; for (int y_ = 0; y_ < height; y_++) { @@ -198,17 +197,17 @@ void c_word::draw_lattice(c_surface* surface, int z_order, int x, int y, int wid unsigned char value = *p_data; if (0x00 == value) { - if (bg_color != COLOR_TRANPARENT) + if (GL_ARGB_A(bg_color)) { - surface->set_pixel(x + x_, y + y_, bg_color_set, z_order); + surface->draw_pixel(x + x_, y + y_, bg_color, z_order); } } else { - b = (GLT_RGB_B(font_color) * value + GLT_RGB_B(bg_color_set) * (255 - value)) >> 8; - g = (GLT_RGB_G(font_color) * value + GLT_RGB_G(bg_color_set) * (255 - value)) >> 8; - r = (GLT_RGB_R(font_color) * value + GLT_RGB_R(bg_color_set) * (255 - value)) >> 8; - surface->set_pixel((x + x_), (y + y_), GLT_RGB(r, g, b), z_order); + b = (GL_RGB_B(font_color) * value + GL_RGB_B(bg_color) * (255 - value)) >> 8; + g = (GL_RGB_G(font_color) * value + GL_RGB_G(bg_color) * (255 - value)) >> 8; + r = (GL_RGB_R(font_color) * value + GL_RGB_R(bg_color) * (255 - value)) >> 8; + surface->draw_pixel((x + x_), (y + y_), GL_RGB(r, g, b), z_order); } p_data++; } @@ -227,8 +226,8 @@ int c_word::get_str_pixel_length(const char *s, const FONT_INFO* font) } int lattice_width = 0; - unsigned int utf8_code; - int utf8_bytes; + unsigned int utf8_code; + int utf8_bytes; while (*s) { utf8_bytes = get_utf8_code(s, utf8_code); diff --git a/gui/gui_include/my_resource.h b/gui/gui_include/my_resource.h index c1b3835..483a148 100644 --- a/gui/gui_include/my_resource.h +++ b/gui/gui_include/my_resource.h @@ -6,24 +6,21 @@ typedef struct struct_color_rect COLOR_RECT; typedef struct struct_bitmap_info BITMAP_INFO; //Redefine them to meet your need. -#define DEFAULT_NORMAL_COLOR GLT_RGB(211, 211, 211) -#define DEFAULT_FOCUS_COLOR GLT_RGB(188, 185, 182) -#define DEFAULT_PUSH_COLOR GLT_RGB(165, 162, 159) -#define DEFAULT_FONT_COLOR GLT_RGB(0, 0, 0) +#define DEFAULT_NORMAL_COLOR GL_RGB(211, 211, 211) +#define DEFAULT_FOCUS_COLOR GL_RGB(188, 185, 182) +#define DEFAULT_PUSH_COLOR GL_RGB(165, 162, 159) +#define DEFAULT_FONT_COLOR GL_RGB(0, 0, 0) enum FONT_TYPE { + FONT_NULL, FONT_ENG_S, FONT_ENG_SB, FONT_ENG_SBM, FONT_ENG_SMB, - FONT_ENG_SMB_AA, - FONT_ENG_MB_AA, - FONT_ENG_MMB_AA, FONT_ENG_MB, FONT_ENG_LLB, FONT_ENG_LLLB, - FONT_ENG_LLLLB, FONT_MAX }; diff --git a/gui/src/button.cpp b/gui/src/button.cpp index 74d317b..c944c1d 100644 --- a/gui/src/button.cpp +++ b/gui/src/button.cpp @@ -13,7 +13,7 @@ void c_button::pre_create_wnd() { m_style |= GLT_ATTR_VISIBLE | GLT_ATTR_FOCUS | ALIGN_HCENTER | ALIGN_VCENTER; - m_font_type = c_my_resource::get_font(FONT_ENG_SMB_AA); + m_font_type = c_my_resource::get_font(FONT_ENG_SMB); m_font_color = c_my_resource::get_color(CTRL_FORE_GROUND); m_bg_color = c_my_resource::get_color(CTRL_BACK_GROUND); } @@ -92,6 +92,6 @@ void c_button::on_paint() if (m_str) { - c_word::draw_string_in_rect(m_surface, m_z_order, m_str, rect, m_font_type, m_font_color, COLOR_TRANPARENT, m_style); + c_word::draw_string_in_rect(m_surface, m_z_order, m_str, rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_style); } } diff --git a/gui/src/dialog.cpp b/gui/src/dialog.cpp index ababc29..369185b 100644 --- a/gui/src/dialog.cpp +++ b/gui/src/dialog.cpp @@ -18,7 +18,7 @@ void c_dialog::pre_create_wnd() { m_style |= GLT_ATTR_VISIBLE|GLT_ATTR_FOCUS; m_z_order = Z_ORDER_LEVEL_1; - m_bg_color = GLT_RGB(33,33,33); + m_bg_color = GL_RGB(33,33,33); } void c_dialog::on_paint() @@ -35,13 +35,13 @@ void c_dialog::on_paint() { for ( unsigned int i = 0; i < m_divider_lines; i++ ) { - m_surface->draw_hline( rect.m_left + 35, rect.m_right - 35, rect.m_top + start_y + (i * interval), GLT_RGB(70, 73, 76), m_z_order); + m_surface->draw_hline( rect.m_left + 35, rect.m_right - 35, rect.m_top + start_y + (i * interval), GL_RGB(70, 73, 76), m_z_order); } } if (m_str) { - c_word::draw_string(m_surface, m_z_order, m_str, rect.m_left+35, rect.m_top, c_my_resource::get_font(FONT_ENG_MB_AA), GLT_RGB(255, 255, 255), COLOR_TRANPARENT, ALIGN_LEFT); + c_word::draw_string(m_surface, m_z_order, m_str, rect.m_left+35, rect.m_top, c_my_resource::get_font(FONT_ENG_MB), GL_RGB(255, 255, 255), GL_ARGB(0, 0, 0, 0), ALIGN_LEFT); } } diff --git a/gui/src/edit.cpp b/gui/src/edit.cpp index 43ff273..0eae46f 100644 --- a/gui/src/edit.cpp +++ b/gui/src/edit.cpp @@ -26,7 +26,7 @@ static c_keyboard s_keyboard; void c_edit::pre_create_wnd() { m_style |= GLT_ATTR_VISIBLE | GLT_ATTR_FOCUS | ALIGN_HCENTER | ALIGN_VCENTER | KEY_BOARD_STYLE; - m_font_type = c_my_resource::get_font(FONT_ENG_SMB_AA); + m_font_type = c_my_resource::get_font(FONT_ENG_SMB); m_font_color = c_my_resource::get_color(CTRL_FORE_GROUND); m_bg_color = c_my_resource::get_color(CTRL_BACK_GROUND); @@ -146,11 +146,11 @@ void c_edit::on_paint() if (strlen(m_str_input)) { - c_word::draw_string_in_rect(m_surface, m_parent->get_z_order(), m_str_input, rect, m_font_type, m_font_color, COLOR_TRANPARENT, m_style); + c_word::draw_string_in_rect(m_surface, m_parent->get_z_order(), m_str_input, rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_style); } else { - c_word::draw_string_in_rect(m_surface, m_parent->get_z_order(), m_str, rect, m_font_type, m_font_color, COLOR_TRANPARENT, m_style); + c_word::draw_string_in_rect(m_surface, m_parent->get_z_order(), m_str, rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_style); } } diff --git a/gui/src/keyboard.cpp b/gui/src/keyboard.cpp index d10a818..f72cb77 100644 --- a/gui/src/keyboard.cpp +++ b/gui/src/keyboard.cpp @@ -166,7 +166,7 @@ void c_keyboard::pre_create_wnd() { m_style = GLT_ATTR_VISIBLE | GLT_ATTR_FOCUS; m_cap_status = STATUS_UPPERCASE; - m_bg_color = GLT_RGB(39,39,39); + m_bg_color = GL_RGB(39,39,39); memset(m_str, 0, sizeof(m_str)); m_str_len = 0; } @@ -246,31 +246,31 @@ void c_keyboard_button::on_paint() if (m_resource_id == 0x14) { - return c_word::draw_string_in_rect(m_surface, m_z_order, "Caps", rect, m_font_type, m_font_color, COLOR_TRANPARENT, m_style); + return c_word::draw_string_in_rect(m_surface, m_z_order, "Caps", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_style); } else if (m_resource_id == 0x1B) { - return c_word::draw_string_in_rect(m_surface, m_z_order, "Esc", rect, m_font_type, m_font_color, COLOR_TRANPARENT, m_style); + return c_word::draw_string_in_rect(m_surface, m_z_order, "Esc", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_style); } else if (m_resource_id == ' ') { - return c_word::draw_string_in_rect(m_surface, m_z_order, "Space", rect, m_font_type, m_font_color, COLOR_TRANPARENT, m_style); + return c_word::draw_string_in_rect(m_surface, m_z_order, "Space", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_style); } else if (m_resource_id == '\n') { - return c_word::draw_string_in_rect(m_surface, m_z_order, "Enter", rect, m_font_type, m_font_color, COLOR_TRANPARENT, m_style); + return c_word::draw_string_in_rect(m_surface, m_z_order, "Enter", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_style); } else if (m_resource_id == '.') { - return c_word::draw_string_in_rect(m_surface, m_z_order, ".", rect, m_font_type, m_font_color, COLOR_TRANPARENT, m_style); + return c_word::draw_string_in_rect(m_surface, m_z_order, ".", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_style); } else if (m_resource_id == 0x7F) { - return c_word::draw_string_in_rect(m_surface, m_z_order, "Back", rect, m_font_type, m_font_color, COLOR_TRANPARENT, m_style); + return c_word::draw_string_in_rect(m_surface, m_z_order, "Back", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_style); } else if (m_resource_id == 0x90) { - return c_word::draw_string_in_rect(m_surface, m_z_order, "?123", rect, m_font_type, m_font_color, COLOR_TRANPARENT, m_style); + return c_word::draw_string_in_rect(m_surface, m_z_order, "?123", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_style); } char letter[] = { 0, 0 }; @@ -282,5 +282,5 @@ void c_keyboard_button::on_paint() { letter[0] = m_resource_id; } - c_word::draw_string_in_rect(m_surface, m_z_order, letter, rect, m_font_type, m_font_color, COLOR_TRANPARENT, m_style); + c_word::draw_string_in_rect(m_surface, m_z_order, letter, rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_style); } \ No newline at end of file diff --git a/gui/src/label.cpp b/gui/src/label.cpp index 6b2cfa1..11ca825 100644 --- a/gui/src/label.cpp +++ b/gui/src/label.cpp @@ -12,9 +12,9 @@ void c_label::pre_create_wnd() { m_style = GLT_ATTR_VISIBLE | ALIGN_LEFT | ALIGN_VCENTER; - m_font_color = GLT_RGB(255,255,255); + m_font_color = GL_RGB(255,255,255); - m_font_type = c_my_resource::get_font(FONT_ENG_SMB_AA); + m_font_type = c_my_resource::get_font(FONT_ENG_SMB); m_bg_color = get_parent()->get_bg_color(); } @@ -26,6 +26,6 @@ void c_label::on_paint() if (m_str) { fill_rect(rect.m_left, rect.m_top, rect.m_right, rect.m_bottom,m_bg_color); - c_word::draw_string_in_rect(m_surface, m_z_order, m_str, rect, m_font_type, m_font_color, COLOR_TRANPARENT, m_style); + c_word::draw_string_in_rect(m_surface, m_z_order, m_str, rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_style); } } diff --git a/gui/src/list_box.cpp b/gui/src/list_box.cpp index b2d1cd3..e248f0a 100644 --- a/gui/src/list_box.cpp +++ b/gui/src/list_box.cpp @@ -27,7 +27,7 @@ void c_list_box::on_init_children() { m_item_total = 0; m_selected_item = 0; - m_font_type = c_my_resource::get_font(FONT_ENG_SMB_AA); + m_font_type = c_my_resource::get_font(FONT_ENG_SMB); m_font_color = c_my_resource::get_color(CTRL_FORE_GROUND); m_bg_color = c_my_resource::get_color(CTRL_BACK_GROUND); } @@ -70,7 +70,7 @@ void c_list_box::on_paint() break; case STATUS_PUSHED: fill_rect_ex(rect, m_bg_color, c_my_resource::get_shape(LIST_BOX_PUSH)); - c_word::draw_string_in_rect(m_surface, m_z_order, m_item_array[m_selected_item], rect, m_font_type, GLT_RGB(2, 124, 165), COLOR_TRANPARENT, ALIGN_HCENTER | ALIGN_VCENTER); + c_word::draw_string_in_rect(m_surface, m_z_order, m_item_array[m_selected_item], rect, m_font_type, GL_RGB(2, 124, 165), GL_ARGB(0, 0, 0, 0), ALIGN_HCENTER | ALIGN_VCENTER); //draw list if (m_item_total > 0) { @@ -87,11 +87,11 @@ void c_list_box::on_paint() ASSERT(FALSE); break; } - c_word::draw_string_in_rect(m_surface, m_z_order, m_item_array[m_selected_item], rect, m_font_type, m_font_color, COLOR_TRANPARENT, ALIGN_HCENTER | ALIGN_VCENTER); + c_word::draw_string_in_rect(m_surface, m_z_order, m_item_array[m_selected_item], rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), ALIGN_HCENTER | ALIGN_VCENTER); if (m_item_total) { - c_word::draw_string_in_rect(m_surface, m_z_order, m_item_array[m_selected_item], rect, m_font_type, m_font_color, COLOR_TRANPARENT, m_style); + c_word::draw_string_in_rect(m_surface, m_z_order, m_item_array[m_selected_item], rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_style); } } @@ -163,7 +163,7 @@ void c_list_box::show_list() { fill_rect_ex(m_list_screen_rect, m_bg_color, c_my_resource::get_shape(LIST_BOX_EXTEND)); - m_font_color = GLT_RGB(255, 255, 255); + m_font_color = GL_RGB(255, 255, 255); //draw all items c_rect tmp_rect; for (int i = 0; i < m_item_total; i++) @@ -172,8 +172,8 @@ void c_list_box::show_list() tmp_rect.m_right = m_list_screen_rect.m_right; tmp_rect.m_top = m_list_screen_rect.m_top + i * ITEM_HEIGHT; tmp_rect.m_bottom = tmp_rect.m_top + ITEM_HEIGHT; - c_word::draw_string_in_rect(m_surface, m_z_order, m_item_array[i], tmp_rect, m_font_type, m_font_color, COLOR_TRANPARENT, ALIGN_HCENTER | ALIGN_VCENTER); - draw_hline(tmp_rect.m_left, tmp_rect.m_right, tmp_rect.m_bottom, GLT_RGB(99, 108, 124)); + c_word::draw_string_in_rect(m_surface, m_z_order, m_item_array[i], tmp_rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), ALIGN_HCENTER | ALIGN_VCENTER); + draw_hline(tmp_rect.m_left, tmp_rect.m_right, tmp_rect.m_bottom, GL_RGB(99, 108, 124)); } //draw selected item tmp_rect.m_left = m_list_screen_rect.m_left; @@ -181,10 +181,10 @@ void c_list_box::show_list() tmp_rect.m_top = m_list_screen_rect.m_top + m_selected_item * ITEM_HEIGHT; tmp_rect.m_bottom = tmp_rect.m_top + ITEM_HEIGHT; - fill_rect_ex(tmp_rect, GLT_RGB(0, 255, 0), c_my_resource::get_shape(LIST_BOX_SELECT)); + fill_rect_ex(tmp_rect, GL_RGB(0, 255, 0), c_my_resource::get_shape(LIST_BOX_SELECT)); - m_font_color = GLT_RGB(255, 255, 255); - c_word::draw_string_in_rect(m_surface, m_z_order, m_item_array[m_selected_item], tmp_rect, m_font_type, m_font_color, COLOR_TRANPARENT, ALIGN_HCENTER | ALIGN_VCENTER); + m_font_color = GL_RGB(255, 255, 255); + c_word::draw_string_in_rect(m_surface, m_z_order, m_item_array[m_selected_item], tmp_rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), ALIGN_HCENTER | ALIGN_VCENTER); } int c_list_box::add_item(char* str) diff --git a/gui/src/spinbox.cpp b/gui/src/spinbox.cpp index 84c4e10..451c49a 100644 --- a/gui/src/spinbox.cpp +++ b/gui/src/spinbox.cpp @@ -21,7 +21,7 @@ GLT_END_MESSAGE_MAP() void c_spin_box::pre_create_wnd() { m_style = GLT_ATTR_VISIBLE | GLT_ATTR_FOCUS | ALIGN_HCENTER | ALIGN_VCENTER; - m_font_type = c_my_resource::get_font(FONT_ENG_SMB_AA); + m_font_type = c_my_resource::get_font(FONT_ENG_SMB); m_bg_color = c_my_resource::get_color(CTRL_BACK_GROUND); m_font_color = c_my_resource::get_color(CTRL_FORE_GROUND); @@ -119,7 +119,7 @@ void c_spin_box::on_kill_focus() void c_spin_box::show_arrow_button() { - fill_rect(m_bt_up_rect.m_left, m_bt_up_rect.m_top, m_bt_down_rect.m_right, m_bt_down_rect.m_bottom, GLT_RGB(99,108,124)); + fill_rect(m_bt_up_rect.m_left, m_bt_up_rect.m_top, m_bt_down_rect.m_right, m_bt_down_rect.m_bottom, GL_RGB(99,108,124)); m_bt_up.connect(this, ID_BT_ARROW_UP, 0, 0, m_wnd_rect.Height(), m_bt_up_rect.Width(),m_bt_up_rect.Height()); m_bt_up.set_bitmap(c_my_resource::get_bmp(BITMAP_UP_BT_NORMAL)); @@ -180,7 +180,7 @@ void c_spin_box::on_paint() show_arrow_button(); m_surface->fill_rect_ex(rect.m_left, rect.m_top, rect.m_right, rect.m_bottom, m_bg_color, c_my_resource::get_shape(LIST_BOX_PUSH),m_parent->get_z_order()); - c_word::draw_value_in_rect(m_surface, m_parent->get_z_order(), m_cur_value, m_digit, rect, m_font_type, GLT_RGB(2, 124, 165), COLOR_TRANPARENT, m_style); + c_word::draw_value_in_rect(m_surface, m_parent->get_z_order(), m_cur_value, m_digit, rect, m_font_type, GL_RGB(2, 124, 165), GL_ARGB(0, 0, 0, 0), m_style); return; break; default: @@ -188,7 +188,7 @@ void c_spin_box::on_paint() break; } - c_word::draw_value_in_rect(m_surface, m_parent->get_z_order(), m_cur_value, m_digit, rect, m_font_type, m_font_color, COLOR_TRANPARENT, m_style); + c_word::draw_value_in_rect(m_surface, m_parent->get_z_order(), m_cur_value, m_digit, rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_style); } void c_spin_box::on_arrow_up_bt_click(unsigned int ctr_id) diff --git a/gui/src/table.cpp b/gui/src/table.cpp index b64d12c..7a8b716 100644 --- a/gui/src/table.cpp +++ b/gui/src/table.cpp @@ -35,7 +35,7 @@ void c_table::draw_item(int row, int col, const char* str, unsigned int with_bg_ } fill_rect(rect.m_left+1, rect.m_top+1, rect.m_right-1, rect.m_bottom-1, back_color); - c_word::draw_string_in_rect(m_surface, m_z_order, str, rect, m_font_type, m_font_color, COLOR_TRANPARENT, m_align_type); + c_word::draw_string_in_rect(m_surface, m_z_order, str, rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_align_type); } void c_table::set_row_height(unsigned int height) diff --git a/sync.bat b/sync.bat index 985baa6..cb91106 100644 --- a/sync.bat +++ b/sync.bat @@ -1,15 +1,15 @@ -::echo off -set url="https://api.powerbi.com/beta/72f988bf-86f1-41af-91ab-2d7cd011db47/datasets/f56a3240-7d0c-45aa-a694-65ebf6a04cc2/rows?key=RHtUJLk6Vi7QIlOBAPENJuCHOT6WbVdBi%%2Fa%%2BhwoDFpaOFhTsPH8zXWE%%2F%%2FFSjPdxF7Lmkf%%2Fl1q2nLgBYk7HYqUQ%%3D%%3D" +echo off +set url="https://api.powerbi.com/beta/72f988bf-86f1-41af-91ab-2d7cd011db47/datasets/2ff1e8a8-2f6f-4d73-a75d-86829e3f4574/rows?key=8f5xLp1gP8%%2FzSee4vCUBcyjR65I9zZ6nb%%2B%%2F7bbzex%%2FSctLX3ntIlAR0sxWpDdguuYyDtLdHK%%2Fxbxj%%2FrSBkX7eQ%%3D%%3D" set date= for /f "tokens=2-4 delims=/ " %%a in ("%date%") do (set MM=%%a& set DD=%%b& set YYYY=%%c) -set datetime=%YYYY%-%MM%-%DD%T%time% -set devie_info=Windows-%USERNAME% +set datetime=%YYYY%-%MM%-%DD%T%time: =0%0+0800 +set devie_info=Win-%USERNAME% set raw_data=[{^ -\"Build time\" :\"%datetime%\",^ -\"Device info\" :\"%devie_info%\",^ -\"Project info\" :\"%1\",^ -\"Weight\" : 1^ +\"device_info\" :\"%devie_info%\",^ +\"project_info\" :\"%1\",^ +\"time\" :\"%datetime%\",^ +\"weight\" : 1^ }] curl.exe --include --request POST --header "Content-Type: application/json" --data-binary^