diff --git a/README.md b/README.md index 23c08f8..9a93102 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,10 @@ - 我们不推荐开发者全盘使用GuiLite;鼓励开发者在吃透代码后,根据自身业务特点,修改出更加丰富、个性的界面;或者发展出适合自己的UI框架。 - 为了聚焦UI核心原理,GuiLite会一直保持单片机的代码体量。 -## 新功能:滑屏demo -- HelloSlide -![HelloSlide](doc/HelloSlide.gif) +## 新功能:动画demo -- HelloAnimation +![HelloAnimation](doc/HelloAnimation.gif) -**信不信由你,代码只有100+行!**[查阅代码](https://gitee.com/idea4good/GuiLiteSamples/blob/master/HelloSlide/UIcode/UIcode.cpp) +**信不信由你,代码只有100+行!**[查阅代码](https://gitee.com/idea4good/GuiLiteSamples/blob/master/HelloAnimation/UIcode/UIcode.cpp) ## 功能介绍 ### 卓越的跨平台能力 @@ -68,6 +68,7 @@ GuiLite只是一个框架,本身并不能生成UI。为了能够展示如何 | --- | --- | --- | --- | --- | | HelloGuiLite | Windows, Linux | 初始化GuiLite,加载资源,布局界面元素,按钮响应 | [编译/运行](https://gitee.com/idea4good/GuiLiteSamples/blob/master/HelloGuiLite/README.md) | 初级 | | HelloFont | Windows, Linux | 显示多种语言(不限:中、英文) | [编译/运行](https://gitee.com/idea4good/GuiLiteSamples/blob/master/HelloFont/README.md) | 初级 | +| HelloAnimation | Windows, Linux | 动画的应用 | [编译/运行](https://gitee.com/idea4good/GuiLiteSamples/blob/master/HelloAnimation/README.md) | 初级 | | HelloSlide | Windows, Linux | 滑屏界面的应用 | [编译/运行](https://gitee.com/idea4good/GuiLiteSamples/blob/master/HelloSlide/README.md) | 中级 | | HostMonitor | iOS, Mac, Android, Windows, Linux | 创建复杂界面,扩展自定义控件,适配全平台 | [编译/运行](https://gitee.com/idea4good/GuiLiteSamples/blob/master/HostMonitor/README.md) | 高级 | ## 开发文档 diff --git a/core/core_include/wnd.h b/core/core_include/wnd.h index 515b233..797e9a7 100644 --- a/core/core_include/wnd.h +++ b/core/core_include/wnd.h @@ -24,7 +24,7 @@ typedef struct struct_wnd_tree { c_wnd* p_wnd; unsigned int resource_id; - char* str; + const char* str; short x; short y; short width; @@ -39,9 +39,9 @@ public: c_wnd(); virtual ~c_wnd() {}; virtual const char* get_class_name() const { return "c_wnd"; } - virtual int connect(c_wnd *parent, unsigned short resource_id, char* str, + virtual int connect(c_wnd *parent, unsigned short resource_id, const char* str, short x, short y, short width, short height, WND_TREE* p_child_tree = NULL); - virtual c_wnd* connect_clone(c_wnd *parent, unsigned short resource_id, char* str, + virtual c_wnd* connect_clone(c_wnd *parent, unsigned short resource_id, const char* str, short x, short y, short width, short height, WND_TREE* p_child_tree = NULL); void disconnect(); virtual c_wnd* clone() = 0; @@ -55,7 +55,7 @@ public: unsigned int get_style() const { return m_style; } virtual void modify_style(unsigned int add_style = 0, unsigned int remove_style = 0); - void set_str(char* str) { m_str = str; } + void set_str(const char* str) { m_str = str; } int is_focus_wnd() const; void set_font_color(unsigned int color) { m_font_color = color; } @@ -125,7 +125,7 @@ protected: c_wnd* m_top_child; c_wnd* m_prev_sibling; c_wnd* m_next_sibling; - char* m_str; + const char* m_str; const FONT_INFO* m_font_type; unsigned int m_font_color; diff --git a/core/src/wnd.cpp b/core/src/wnd.cpp index 6aa9151..32b539a 100644 --- a/core/src/wnd.cpp +++ b/core/src/wnd.cpp @@ -17,7 +17,7 @@ void c_wnd::pre_create_wnd() m_style = GL_ATTR_VISIBLE | GL_ATTR_FOCUS; } -int c_wnd::connect(c_wnd *parent, unsigned short resource_id, char* str, +int c_wnd::connect(c_wnd *parent, unsigned short resource_id, const char* str, short x, short y, short width, short height, WND_TREE* p_child_tree ) { if(0 == resource_id) @@ -94,7 +94,7 @@ int c_wnd::load_child_wnd(WND_TREE *p_child_tree) return sum; } -c_wnd* c_wnd::connect_clone(c_wnd *parent, unsigned short resource_id, char* str, +c_wnd* c_wnd::connect_clone(c_wnd *parent, unsigned short resource_id, const char* str, short x, short y, short width, short height, WND_TREE* p_child_tree ) { if(0 == resource_id) diff --git a/doc/HelloAnimation.gif b/doc/HelloAnimation.gif new file mode 100644 index 0000000..e24a6fd Binary files /dev/null and b/doc/HelloAnimation.gif differ