#include <stdio.h> #include "graphapp.h" void draw_shapes(Control *c, Graphics *g) { Rect r = get_control_area(c); set_colour(g, RED); draw_rect(g, r); set_colour(g, BLUE); fill_rect(g, rect(10,40,80,10)); } int main(int argc, char *argv[]) { App *app; Window *w; Control *c; Rect r; app = new_app(argc, argv); w = new_window(app, rect(50,50,150,200), "Rectangles", STANDARD_WINDOW); set_window_background(w, LIGHT_GREY); r = rect(10,10,100,100); c = new_control(w, r); on_control_redraw(c, draw_shapes); show_window(w); main_loop(app); return 0; }
Notes: