void fillWorldWithWalls() { for(int x = 0; x < get_world_width(); x++) { for(int y = 0; y < get_world_height(); y++) { setup_wall(x, y); } } }
int main(int argc, char** argv) { pgcolor color; struct pgmodeinfo mi; int i; pghandle ttl_box; /* init PicoGUI client */ pgInit(argc,argv); pgRegisterApp(PG_APP_NORMAL, argv[0], 0); /* create the title */ ttl_box = pgNewWidget(PG_WIDGET_BOX,0,0); ttl_text = pgNewWidget(PG_WIDGET_LABEL, PG_DERIVE_INSIDE, ttl_box); pgSetWidget (PGDEFAULT, PG_WP_TEXT, pgNewString("wclock"), 0); pgNewWidget(PG_WIDGET_BUTTON, PG_DERIVE_INSIDE, ttl_box); pgSetWidget (PGDEFAULT, PG_WP_SIDE, PG_S_RIGHT, PG_WP_TEXT, pgNewString("?"), PG_WP_EXTDEVENTS, PG_EXEV_PNTR_DOWN, 0); pgBind (PGDEFAULT, PG_WE_PNTR_DOWN, &btn_handler, (void*)btnid_set); pgNewWidget(PG_WIDGET_BUTTON, PG_DERIVE_INSIDE, ttl_box); pgSetWidget (PGDEFAULT, PG_WP_SIDE, PG_S_LEFT, PG_WP_TEXT, pgNewString(">"), PG_WP_EXTDEVENTS, PG_EXEV_PNTR_DOWN, 0); pgBind (PGDEFAULT, PG_WE_PNTR_DOWN, &btn_handler, (void*)btnid_right); pgNewWidget(PG_WIDGET_BUTTON, PG_DERIVE_INSIDE, ttl_box); pgSetWidget (PGDEFAULT, PG_WP_SIDE, PG_S_LEFT, PG_WP_TEXT, pgNewString("<"), PG_WP_EXTDEVENTS, PG_EXEV_PNTR_DOWN, 0); pgBind (PGDEFAULT, PG_WE_PNTR_DOWN, &btn_handler, (void*)btnid_left); /* create the main context */ main_window = pgNewWidget(PG_WIDGET_CANVAS, PG_DERIVE_AFTER, ttl_box); pgBind(PGDEFAULT, PGBIND_ANY, &canvas_handler, NULL); /* init time zones */ init_zones(); /* activate mouse move, keyboard and focus events */ pgSetWidget(main_window, PG_WP_TRIGGERMASK, pgGetWidget(main_window, PG_WP_TRIGGERMASK) | PG_TRIGGER_MOVE | PG_TRIGGER_CHAR | PG_TRIGGER_KEYDOWN | PG_TRIGGER_KEYUP /* | PG_TRIGGER_ACTIVATE | PG_TRIGGER_DEACTIVATE */, 0); mi = *pgGetVideoMode(); width = mi.lxres; height = mi.lyres; /* Make a backbuffer bitmap */ world_bitmap = create_world_bitmap(); width = get_world_width(); height = get_world_height(); /* Set the clipping rectangle */ pgWriteCmd(main_window, PGCANVAS_GROP, 5, PG_GROP_SETCLIP, 0, 0, width, height + TIMEBAR_HEIGHT); /* Set to be always rendered */ pgWriteCmd(main_window, PGCANVAS_GROPFLAGS, 1, PG_GROPF_UNIVERSAL); /* Create contexts for the canvas itself and the back-buffer */ gfx_context = pgNewCanvasContext(main_window, PGFX_IMMEDIATE ); /* run all */ DPRINTF(">>> entering loop\n"); pgEventLoop(); return 0; }