<1>/* Graphics Not Rendered in HTML */ #define MAP_HEIGHT 2048 #define MAP_WIDTH 2048 #define TREES_NUM 256 I64 tree_x[TREES_NUM], tree_y[TREES_NUM]; U0 DrawIt(CTask *task, CDC *dc) { I64 i, h, v; task->horz_scroll.min = 0; task->horz_scroll.max = MAP_WIDTH - task->pix_width; task->vert_scroll.min = 0; task->vert_scroll.max = MAP_HEIGHT - task->pix_height; TaskDerivedValsUpdate(task); h = task->horz_scroll.pos; v = task->vert_scroll.pos; dc->color = BROWN; dc->thick = 4; GrLine3(dc, 2 - h, 2 - v, 0, MAP_WIDTH - 3 - h, 2 - v, 0); GrLine3(dc, 2 - h, MAP_HEIGHT - 3 - v, 0, MAP_WIDTH - 3 - h, MAP_HEIGHT - 3 - v, 0); GrLine3(dc, 2 - h, 2 - v, 0, 2 - h, MAP_HEIGHT - 3 - v, 0); GrLine3(dc, MAP_WIDTH - 3 - h, 2 - v, 0, MAP_WIDTH - 3 - h, MAP_HEIGHT - 3 - v, 0); //Check bounds if you wish better performance. for (i = 0; i < TREES_NUM; i++) Sprite3(dc, tree_x[i] - h, tree_y[i] - v, 0, <Tree>); } U0 Init() { I64 i; for (i = 0; i < TREES_NUM; i++) { tree_x[i] = RandU16 % MAP_WIDTH; tree_y[i] = RandU16 % MAP_HEIGHT; } } U0 ScrollBars() { SettingsPush; //See SettingsPush Init; Fs->draw_it = &DrawIt; WinBorder(ON); DocCursor; DocClear; DocScroll; Fs->horz_scroll.pos = 0; Fs->vert_scroll.pos = 0; CharGet(, FALSE); SettingsPop; //If you care, you might want to //save the original state of the //scroll bars. } ScrollBars;