hschumann2/TempleOS-Source-Code
0847
1 2//Test image which we will determine the extents of.3 4 5<1>/* Graphics Not Rendered in HTML */6 7 8U0 Extents()9{10 CDC *dc=DCAlias;11 I64 min_x,max_x,min_y,max_y;12 13 //Scrn, not win coordinates.14 I64 h=Fs->pix_left+Fs->scroll_x,v=Fs->pix_top+Fs->scroll_y;15 16 DocClear;17 DCFill;18 19 //This sets a flag to record the20 //extents of what we draw and inits21 //the max's and min's. Vals are22 //scrn coordinates.23 DCExtentsInit(dc);24 25 dc->thick=3;26 Sprite3(dc,40,GR_HEIGHT>>1,0,<1>);27 28 dc->color=LTRED;29 dc->thick=1;30 31 //This box is the extents.32 GrLine(dc,dc->min_x-h,dc->min_y-v,dc->max_x-h,dc->min_y-v);33 GrLine(dc,dc->min_x-h,dc->min_y-v,dc->min_x-h,dc->max_y-v);34 GrLine(dc,dc->max_x-h,dc->max_y-v,dc->max_x-h,dc->min_y-v);35 GrLine(dc,dc->max_x-h,dc->max_y-v,dc->min_x-h,dc->max_y-v);36 37 DCDel(dc);38 PressAKey;39 DCFill;40 41 SpriteExtents(<1>,&min_x,&max_x,&min_y,&max_y);42 "X: %d to %d\n",min_x,max_x;43 "Y: %d to %d\n",min_y,max_y;44}45 46Extents;47 