void RivenInventory::draw() { // Clear the inventory area clearArea(); // Draw the demo's exit button if (_vm->getFeatures() & GF_DEMO) { // extras.mhk tBMP 101 contains "EXIT" instead of Atrus' journal in the demo! // The demo's extras.mhk contains all the other inventory/marble/credits image // but has hacked tBMP 101 with "EXIT". *sigh* _vm->_gfx->drawExtrasImageToScreen(101, _demoExitRect); } else { // There are three books and three vars. We have three different // combinations. At the start you have just Atrus' journal. Later, // you get Catherine's journal and the trap book. Near the end, // you lose the trap book and have just the two journals. bool hasCathBook = _vm->_vars["rrebel"] == 5 || _vm->_vars["rrebel"] == 6; bool hasTrapBook = _vm->_vars["atrapbook"] == 1; if (!hasCathBook) { _vm->_gfx->drawExtrasImageToScreen(101, _atrusJournalRect1); } else if (!hasTrapBook) { _vm->_gfx->drawExtrasImageToScreen(101, _atrusJournalRect2); _vm->_gfx->drawExtrasImageToScreen(102, _cathJournalRect2); } else { _vm->_gfx->drawExtrasImageToScreen(101, _atrusJournalRect3); _vm->_gfx->drawExtrasImageToScreen(102, _cathJournalRect3); _vm->_gfx->drawExtrasImageToScreen(100, _trapBookRect3); } } }
static status computeBoundingBoxBezier(Bezier b) { reg r; r.minx = 1000000; r.miny = 1000000; r.maxx = -1000000; r.maxy = -10000000; if ( b->selected == ON ) { int mw=5, mh=5; include_in_reg(&r, b->start); include_in_reg(&r, b->end); include_in_reg(&r, b->control1); if ( notNil(b->control2) ) include_in_reg(&r, b->control2); r.minx -= (mw+1)/2; r.maxx += (mw+1)/2; r.miny -= (mh+1)/2; r.maxy += (mh+1)/2; } else { ipoint ptsbuf[MAXPTS]; IPoint pts = ptsbuf; int npts = MAXPTS; int i; compute_points_bezier(b, pts, &npts); for(i=0; i<npts; i++,pts++) { if ( pts[0].x < r.minx ) r.minx = pts[0].x; if ( pts[0].x > r.maxx ) r.maxx = pts[0].x; if ( pts[0].y < r.miny ) r.miny = pts[0].y; if ( pts[0].y > r.maxy ) r.maxy = pts[0].y; } } if ( r.maxx >= r.minx && r.maxy >= r.miny ) { int pens = valInt(b->pen) / 2; int pena = (valInt(b->pen) % 2 == 0 ? pens : pens + 1); r.minx -= pens; r.maxx += pena; r.miny -= pens; r.maxy += pena; assign(b->area, x, toInt(r.minx)); assign(b->area, y, toInt(r.miny)); assign(b->area, w, toInt(r.maxx - r.minx)); assign(b->area, h, toInt(r.maxy - r.miny)); } else clearArea(b->area); if ( adjustFirstArrowBezier(b) ) unionNormalisedArea(b->area, b->first_arrow->area); if ( adjustSecondArrowBezier(b) ) unionNormalisedArea(b->area, b->second_arrow->area); succeed; }
void RivenInventory::onFrame() { bool visible = isVisible(); if (visible && !_inventoryDrawn) { draw(); _inventoryDrawn = true; } else if (!visible && _inventoryDrawn) { clearArea(); _inventoryDrawn = false; } }
void emu_stateCb(const char *str) { if (giz_screen != NULL) Framework2D_UnlockBuffer(); giz_screen = Framework2D_LockBuffer(1); clearArea(0); blit("", str); Framework2D_UnlockBuffer(); giz_screen = NULL; Sleep(0); /* yield the CPU, the system may need it */ }
void emu_stateCb(const char *str) { if (giz_screen != NULL) fb_unlock(); giz_screen = fb_lock(1); clearArea(0); blit("", str); fb_unlock(); giz_screen = NULL; Sleep(0); /* yield the CPU, the system may need it */ }
void D3D11RenderAPI::clearViewport(UINT32 buffers, const Color& color, float depth, UINT16 stencil, UINT8 targetMask) { THROW_IF_NOT_CORE_THREAD; if(mActiveRenderTarget == nullptr) return; const RenderTargetProperties& rtProps = mActiveRenderTarget->getProperties(); Rect2I clearArea((int)mViewport.TopLeftX, (int)mViewport.TopLeftY, (int)mViewport.Width, (int)mViewport.Height); bool clearEntireTarget = clearArea.width == 0 || clearArea.height == 0; clearEntireTarget |= (clearArea.x == 0 && clearArea.y == 0 && clearArea.width == rtProps.getWidth() && clearArea.height == rtProps.getHeight()); if (!clearEntireTarget) { // TODO - Ignoring targetMask here D3D11RenderUtility::instance().drawClearQuad(buffers, color, depth, stencil); BS_INC_RENDER_STAT(NumClears); } else clearRenderTarget(buffers, color, depth, stencil, targetMask); }
static void RunEvents(unsigned int which) { if (which & 0x1800) // save or load (but not both) { int do_it = 1; if (PsndOut != NULL) FrameworkAudio_SetPause(1); if (giz_screen == NULL) giz_screen = Framework2D_LockBuffer(1); if ( emu_checkSaveFile(state_slot) && (( (which & 0x1000) && (currentConfig.EmuOpt & 0x800)) || // load (!(which & 0x1000) && (currentConfig.EmuOpt & 0x200))) ) // save { int keys; blit("", (which & 0x1000) ? "LOAD STATE? (PLAY=yes, STOP=no)" : "OVERWRITE SAVE? (PLAY=yes, STOP=no)"); while( !((keys = Framework_PollGetButtons()) & (BTN_PLAY|BTN_STOP)) ) Sleep(50); if (keys & BTN_STOP) do_it = 0; while( ((keys = Framework_PollGetButtons()) & (BTN_PLAY|BTN_STOP)) ) // wait for release Sleep(50); clearArea(0); } if (do_it) { osd_text(4, 232, (which & 0x1000) ? "LOADING GAME" : "SAVING GAME"); PicoStateProgressCB = emu_stateCb; emu_SaveLoadGame((which & 0x1000) >> 12, 0); PicoStateProgressCB = NULL; Sleep(0); } if (PsndOut != NULL) FrameworkAudio_SetPause(0); reset_timing = 1; }
int submain(int argc,char **argv) { DpGraphicsContext_t gc; int x1,y1,x2,y2,cx,cy,dx,dy,dx1,dy1,dx2,dy2,i,j,k,x,y,r,rdx,rdy,dblDash; int sax1[StringArc],say1[StringArc],sax2[StringArc],say2[StringArc]; static unsigned char dashes[]={4,2,1,2}; double th,t1,t2; DpClipNode_t scn; if( argc>1 && argv[argc-1][0]=='d') { dblDash=1; } else { printf("Add a 'd' to have the lines in double-dash\n"); dblDash=0; } printf("This is the first line-drawing primitive test code\n\n"); printf("First map the screen\n"); printf("Press RETURN\n"); while(getchar()!='\n'); if(dpMapScreen(&sc,2)==NULL) { printf("Cannot map screen\n"); return 1; } setMask(&sc,5,5); gc.depth = 1; gc.function = GXcopy; gc.planeMask = 0xFFFFFFFF; gc.foreground = 1; gc.background = 0; gc.fillStyle = FillSolid; gc.tile = NULL; gc.stipple = NULL; gc.tsXOrigin = 0; gc.tsYOrigin = 0; gc.clipXOrigin = -5; gc.clipYOrigin = -5; gc.clipMask = msk; gc.lineWidth = 0; gc.lineStyle = dblDash?LineDoubleDash:LineSolid; gc.capStyle = CapButt; gc.joinStyle = JoinMiter; gc.dashOffset = 0; gc.dashLength = 4; gc.dashList = dashes; scn.nextNode = NULL; scn.node[0] = DpMakeNegInf(12); scn.node[1] = DpMakeNegInf(2); scn.node[2] = DpMakePosInf(2); scn.node[3] = 0; scn.node[4] = DpMakeNegInf(4); scn.node[5] = 0; scn.node[6] = sc.sizeX; scn.node[7] = DpMakePosInf(4); scn.node[8] = sc.sizeY; scn.node[9] = DpMakeNegInf(2); scn.node[10] = DpMakePosInf(2); scn.node[11] = DpMakePosInf(12); printf("Clear the screen to col 0 and draw a line centred \n"); printf(" horizontally about the centre of the screen \n"); printf(" and half a screen-width in length \n"); printf("Press RETURN\n"); while(getchar()!='\n'); clearArea(&sc,0,0,sc.sizeX,sc.sizeY,0); x1 = sc.sizeX/4; x2 = 3*sc.sizeX/4; y1 = sc.sizeY/2; y2 = sc.sizeY/2; dpDrawLine(&sc,&gc,x1,y1,x2,y2); printf("First test complete. Press RETURN\n"); while(getchar()!='\n'); printf("Now similarly but vertical. Press RETURN\n"); clearArea(&sc,0,0,sc.sizeX,sc.sizeY,0); x1 = sc.sizeX/2 ; x2 = sc.sizeX/2; y1 = sc.sizeY/4 ; y2 = 3*sc.sizeY/4; dpDrawLine(&sc,&gc,x1,y1,x2,y2); printf("Now draw a series of nearly horizontal lines, all\n"); printf(" going through the centre point. All lines are \n"); printf(" drawn from left to right. \n"); printf("Press RETURN\n"); while(getchar()!='\n'); clearArea(&sc,0,0,sc.sizeX,sc.sizeY,0); cx = sc.sizeX/2; cy = sc.sizeY/2; dx = 3*cx/4; dy = dx-1; for(;dy>-dx+1;dy-=3) dpDrawLine(&sc,&gc,cx-dx,cy-dy,cx+dx,cy+dy); printf("\nNext test : A set of lines forming the spokes of a wheel\n"); printf("(36 lines in total, drawn from the centre)\n"); printf("Press RETURN\n"); while(getchar()!='\n'); clearArea(&sc,0,0,sc.sizeX,sc.sizeY,0); cx = sc.sizeX/2; cy = sc.sizeY/2; r=3*sc.sizeX/8; if(r>3*sc.sizeY/8) r=3*sc.sizeY/8; for(th=0.0,i=0;i<36;th+=(2*Pi)*10/360,i++) { x = (int)(cos(th)*r); y = (int)(sin(th)*r); dpDrawLine(&sc,&gc,cx,cy,cx+x,cy+y); } printf("\nNext test : A pretty pattern\n"); printf("Press RETURN ...\n"); while(getchar()!='\n'); clearArea(&sc,0,0,sc.sizeX,sc.sizeY,0); cx=sc.sizeX/2; cy=sc.sizeY/2; rdx=7*sc.sizeX/16; rdy=7*sc.sizeY/16; for(t1=0.0,t2=3*Pi/180,i=0; i<90; t1+=28*Pi/180,t2+=42*Pi/180,i++) { dpDrawLine(&sc,&gc,cx+(int)(cos(t1)*rdx),cy+(int)(sin(t1)*rdy), cx+(int)(cos(t2)*rdx),cy+(int)(sin(t2)*rdy)); } printf("\nNext test : A string-arc\n"); printf("Press RETURN ...\n"); while(getchar()!='\n'); clearArea(&sc,0,0,sc.sizeX,sc.sizeY,0); sax1[0]=100;say1[0]=100; sax2[0]=300;say2[0]=320; gc.function=GXxor; dx1=3; dy1=5; dx2=7; dy2=11; for(i=0;1;i++) { j=i%StringArc; k=(i+1)%StringArc; if(i>=StringArc) dpDrawLine(&sc,&gc,sax1[k],say1[k],sax2[k],say2[k]); x = sax1[j]+dx1; y = say1[j]+dy1; if(x>=sc.sizeX) { x=2*sc.sizeX-x-1; dx1=-dx1; } if(x<0) { x=-x; dx1=-dx1; } if(y>=sc.sizeY) { y=2*sc.sizeY-y-1; dy1=-dy1; } if(y<0) { y=-y; dy1=-dy1; } sax1[k]=x; say1[k]=y; x = sax2[j]+dx2; y = say2[j]+dy2; if(x>=sc.sizeX) { x=2*sc.sizeX-x-1; dx2=-dx2; } if(x<0) { x=-x; dx2=-dx2; } if(y>=sc.sizeY) { y=2*sc.sizeY-y-1; dy2=-dy2; } if(y<0) { y=-y; dy2=-dy2; } sax2[k]=x; say2[k]=y; dpDrawLine(&sc,&gc,sax1[k],say1[k],sax2[k],say2[k]); } printf("End of test1L. Press RETURN\n"); while(getchar()!='\n'); dpDestructPixmap(&sc,0); return 0; }
void GUI::clear_area(IntPoint start, IntPoint size) { clearArea(start.col, start.row, size.row, size.col, screen, BLACK); }