dirty redraw and SDL framebuffer example
[windtk] / src / windtk.h
index 0435e6f..996d473 100644 (file)
@@ -49,10 +49,18 @@ struct wt_image {
 };
 
 struct wt_rect {
-       int x, y, width, height;
+       int x, y, w, h;
+};
+
+/* graphics flags */
+enum {
+       WT_GFX_RGB              = 1,    /* RGB mode, calls newcolor to set current, not to allocate */
+       WT_GFX_NODIRTY  = 2             /* don't use dirty rects, always redraw completely */
 };
 
 struct wt_graphics {
+       unsigned int flags;
+
        int (*newcolor)(int r, int g, int b);
        void (*color)(int c);
 
@@ -100,10 +108,17 @@ void wt_inp_motion(int x, int y);
 
 void wt_draw(void);
 
+/* screen regions updated by the last wt_draw */
+int wt_num_upd(void);
+struct wt_rect *wt_upd_rect(int idx);
+void wt_add_upd_rect(struct wt_rect *r);
+
 wt_widget *wt_alloc_widget(wt_widget *par);
 void wt_free_widget(wt_widget *w);
 void wt_free_tree(wt_widget *tree);
 
+void wt_dirty_widget(wt_widget *w);            /* propagates to children */
+
 wt_widget *wt_window(wt_widget *par, const char *title, int style, int x, int y, int width, int height);
 wt_widget *wt_label(wt_widget *par, const char *text, int x, int y);
 wt_widget *wt_button(wt_widget *par, const char *text, int x, int y, int width, int height);
@@ -154,5 +169,7 @@ int wt_isenabled(wt_widget *w);
 void wt_callback(wt_widget *w, int type, wt_callback_func func, void *cls);
 
 void wt_rect(struct wt_rect *r, int x, int y, int w, int h);
+void wt_rect_union(struct wt_rect *a, struct wt_rect *b);
+int wt_rect_overlap(struct wt_rect *a, struct wt_rect *b);
 
 #endif /* WINDTK_H_ */