int normal_draw(dxO& dxo)override{ try{ try{ IsDataModeMUIBut.set(Pint(70, 20), "Data"); dxo.draw(Pint(5, 5), IsDataModeMUIBut); } catch(const hmLib::inquiries::unconnected_exception&){ dxo.draw(Pint(5, 5), dxoStrP(Pint(70, 20), "Data", getClr(error, strobj))); } try{ dxo.draw(Pint(80, 5), dxoBUITimeStr(this, Pint(70, 20), (boost::format("%.1f��") % Value).str(), Time)); } catch(const hmLib::inquiries::unconnected_exception&){ dxo.draw(Pint(80, 5), dxoStrP(Pint(70, 20), "NoCnct", getClr(error, strobj))); } } catch(const hmLib::exceptions::exception& Excp){ dxo.draw(Pint(5, 5), dxoButIO(getSize(), std::string("=ERR=") + Excp.what(), getClr(error, butobj), true, CLR::White, ALI::left)); } return 0; }
void TrapGasFear::trigger(Actor& actor, const AbilityRollResult dodgeResult) { traceVerbose << "TrapGasFear::trigger()..." << endl; (void)dodgeResult; const bool IS_PLAYER = &actor == eng.player; const bool CAN_SEE = actor.getPropHandler().allowSee(); const bool CAN_PLAYER_SEE_ACTOR = eng.player->isSeeingActor(actor, NULL); const string actorName = actor.getNameThe(); if(IS_PLAYER) { if(CAN_SEE) { eng.log->addMsg("I am hit by a burst of gas!"); } else { eng.log->addMsg( "A mechanism triggers, I am hit by a burst of gas!"); } } else { if(CAN_PLAYER_SEE_ACTOR) { eng.log->addMsg(actorName + " is hit by a burst of gas!"); } } SDL_Color clr = getClr(); Explosion::runExplosionAt( pos_, eng, ExplType::applyProp, ExplSrc::misc, 0, SfxId::endOfSfxId, new PropTerrified(eng, propTurnsStd), &clr); traceVerbose << "TrapGasFear::trigger() [DONE]" << endl; }
int normal_draw(dxO& dxo)override{ try{ try{ IsDataModeMUIBut.set(Pint(70, 20), "Data"); dxo.draw(Pint(5, 5), IsDataModeMUIBut); } catch(const hmLib::inquiries::unconnected_exception&){ dxo.draw(Pint(5, 5), dxoStrP(Pint(70, 20), "Data", getClr(error, strobj))); } try{ int gpsCh; dxRGB clr; if(inq_getPic_GPSCh() == inq_getRequest_GPSCh()){ clr = getClr(normal, butobj); } else{ clr = getClr(active, butobj); } if(inq_getRequest_GPSCh()){ gpsCh = 1; } else{ gpsCh = 0; } SetGPSNumBut.set(Pint(70, 20), (boost::format("GPS#:%d") % (int)gpsCh).str(), clr); auto ans = dxo.draw(Pint(80, 5), SetGPSNumBut); if(ans == -1){ signal_changeGPSCh(); } } catch(const hmLib::inquiries::unconnected_exception&){ dxo.draw(Pint(80, 5), dxoStrP(Pint(70, 20), "NoCnct", getClr(error, strobj))); } try{ auto Data = GPSData;//inquiry_getGPSData(); auto Time = Data.getTime(); dxo.draw(Pint(155, 5), dxoStrP(Pint(70, 20), (boost::format("Fail:%d") % static_cast<int>(Data.getFail())).str(), getTimeStrClr(Time))); } catch(const hmLib::inquiries::unconnected_exception&){ dxo.draw(Pint(155, 5), dxoStrP(Pint(70, 20), "NoCnct", getClr(error, strobj))); } } catch(const hmLib::exceptions::exception& Excp){ dxo.draw(Pint(0, 0), dxoButIO(getSize(), std::string("=ERR=") + Excp.what(), getClr(error, butobj), true, CLR::White, ALI::left)); } return 0; }
int extend_draw(dxO& dxo)override{ normal_draw(dxo); try{ auto Data = GPSData;//inquiry_getGPSData(); auto Time = Data.getTime(); dxo.draw(Pint(80, 30), dxoStrP(Pint(145, 20), (boost::format("N:%.4f") % Data.getPos().y).str(), getTimeStrClr(Time))); dxo.draw(Pint(80, 55), dxoStrP(Pint(145, 20), (boost::format("E:%.4f") % Data.getPos().x).str(), getTimeStrClr(Time))); dxo.draw(Pint(80, 80), dxoStrP(Pint(145, 20), (boost::format("H:%.4f") % Data.getHeight()).str(), getTimeStrClr(Time))); dxo.draw(Pint(5, 55), dxoStrP(Pint(70, 20), (boost::format("GPS#:%d") % Data.getUseGPS()).str(), getTimeStrClr(Time))); //dxo.draw(Pint(5,80),dxoStrP(Pint(70,20),(boost::format("Fail:%d")%static_cast<int>(Data.getFail())).str(),getTimeStrClr(Time))); } catch(const hmLib::inquiries::unconnected_exception&){ dxo.draw(Pint(80, 30), dxoStrP(Pint(145, 20), "NoCnct", getClr(error, strobj))); dxo.draw(Pint(80, 55), dxoStrP(Pint(145, 20), "NoCnct", getClr(error, strobj))); dxo.draw(Pint(80, 80), dxoStrP(Pint(145, 20), "NoCnct", getClr(error, strobj))); dxo.draw(Pint(5, 55), dxoStrP(Pint(70, 20), "NoCnct", getClr(error, strobj))); //dxo.draw(Pint(5,80),dxoStrP(Pint(70,20),"NoCnct",getClr(error,strobj))); } return 0; }
int normal_draw(dxO& dxo)override{ try{ try{ DataModeMUIBut.set(Pint(70, 20), "Data"); dxo.draw(Pint(5, 5), DataModeMUIBut); } catch(const hmLib::inquiries::unconnected_exception&){ dxo.draw(Pint(5, 5), dxoStrP(Pint(70, 20), "CO2", getClr(error, strobj))); } try{ dxo.draw(Pint(80, 5), dxoBUITimeStr(this, Pint(70, 20), (boost::format("%.1fppm") % Data.value()).str(), Data.time())); dxo.draw(Pint(155, 5), dxoBUITimeStr(this, Pint(70, 20), (boost::format("0x%04x") % Data.raw_value()).str(), Data.time())); } catch(const hmLib::inquiries::unconnected_exception&){ dxo.draw(Pint(80, 5), dxoStrP(Pint(70, 20), "NoCnct", getClr(error, strobj))); } } catch(const hmLib::exceptions::exception& Excp){ dxo.draw(Pint(5, 5), dxoButIO(getSize(), std::string("=ERR=") + Excp.what(), getClr(error, butobj), true, CLR::White, ALI::left)); } try{ SensorPWMUIBut.set(Pint(70, 20), "SensorPW"); dxo.draw(Pint(80, 30), SensorPWMUIBut); } catch(const hmLib::inquiries::unconnected_exception&){ dxo.draw(Pint(80, 30), dxoStrP(Pint(70, 20), "NoCnct", getClr(error, strobj))); } try{ PumpPWMUIBut.set(Pint(70, 20), "PumpPW"); dxo.draw(Pint(155, 30), PumpPWMUIBut); } catch(const hmLib::inquiries::unconnected_exception&){ dxo.draw(Pint(155, 30), dxoStrP(Pint(70, 20), "NoCnct", getClr(error, strobj))); } return 0; }
//virtual int fndraw(dxO& dxf); int normal_draw(dxO& dxo)override{ // FILE 書き込みボタン if(dxo.draw(Pint(5, 5), dxoButIO(Pint(105, 20), "FILE 接続", getClr(normal, butobj), isActive), true) == 1){ if(!isActive){ // Open signal signal_require_activate(""); } else{ // Close signal signal_require_inactivate(); } } // 状態表示 if(isActive){ dxo.draw(Pint(115, 5), dxoStrP(Pint(105, 20), "Opened", getClr(normal, strobj))); } else{ dxo.draw(Pint(115, 5), dxoStrP(Pint(105, 20), "Closed", getClr(invalid, strobj))); } return 0; }
void drawOverlay () { Vector4DF clr; Matrix4F proj, view, model; proj.Scale ( 2.0/window_width, -2.0/window_height, 1 ); model.Translate ( cam.getToPos().x, cam.getToPos().y, 1 ); view.Scale ( cam.getToPos().z, 1, 1 ); view *= model; model.Identity (); //----- 2D Drawing (visualizer space) setview2D ( model.GetDataF(), view.GetDataF(), proj.GetDataF() ); setorder2D ( false, 1 ); updatestatic2D ( 0 ); // update model/view/proj matrices of each static draw layer updatestatic2D ( 1 ); updatestatic2D ( 2 ); updatestatic2D ( 3 ); // Selector Bar start2D (); drawRect ( mSelectID*10, 0, mSelectID*10+10, NUM_BIN*25, 1,1,1,1 ); // Same-State Highlights (yellow) int minE = (((0-window_width/2.0)/cam.getToPos().z) - cam.getToPos().x) / 10; int maxE = (((window_width - window_width/2.0)/cam.getToPos().z) - cam.getToPos().x) / 10; minE = ( minE < 0 ) ? 0 : minE; maxE = ( maxE >= mEvents.size() ) ? mEvents.size() : maxE; for (int n=0; n < mEvents.size(); n++ ) { if ( mEvents[n].bin_id[mSelectBin] == mEvents[mSelectID].bin_id[mSelectBin] && n > minE && n < maxE ) { drawRect ( n*10, mSelectBin*25, n*10+10, mSelectBin*25+24, 1,1,0,1 ); drawRect ( n*10+1, mSelectBin*25+1, n*10+9, mSelectBin*25+23, 1,1,0,1 ); } } end2D (); //----- 2D Drawing (screen space) setview2D ( window_width, window_height ); // change to screen space setorder2D ( true, -0.00001 ); start2D (); // dynamic draw int panel_width = 200; float xoff = window_width - panel_width; float yoff = cam.getToPos().y + (window_height/2); // Left panel - Bin Text char name[128]; char msg[1024]; int frame = mEvents[mSelectID].frame; frame = (frame < 0 || frame >= mFrames.size() ) ? 0 : frame; Frame& f = mFrames[ frame ]; drawFill ( 0, yoff, +panel_width, yoff + NUM_BIN*25+250, 0.15,0.15,0.2,0.75 ); drawText ( 10, yoff-85, "Frame #:", 1,1,1,1 ); drawText ( 10, yoff-70, "Frame Draws:", 1,1,1,1 ); drawText ( 10, yoff-55, "Frame Prims:", 1,1,1,1 ); drawText ( 10, yoff-40, "Frame Transfer:", 1,1,1,1 ); drawText ( 10, yoff-20, "Frame States:", 1,1,1,1 ); sprintf ( msg, "%d", frame ); drawText ( 100, yoff - 85, msg, 1,1,1,1 ); sprintf ( msg, "%d", f.totalDraw ); drawText ( 100, yoff - 70, msg, 1,1,1,1 ); sprintf ( msg, "%d", f.totalPrim ); drawText ( 100, yoff - 55, msg, 1,1,1,1 ); sprintf ( msg, "%d bytes", f.totalTransfer ); drawText ( 100, yoff - 40, msg, 1,1,1,1 ); setText ( 0.8, 0 ); drawText ( 100, yoff - 20, "Modify", 1,0,0,1 ); drawText ( 125, yoff - 10, "Switch", 1,0.5,0,1 ); drawText ( 150, yoff - 20, "Reuse", 0,1,0,1 ); drawText ( 175, yoff - 10, "Unique", 1,1,1,1 ); drawTri ( 100, yoff-10, 100+10, yoff-10, 100, yoff, 1, 0,0, 1); drawTri ( 125, yoff-10, 125+10, yoff-10, 125, yoff, 1,.5,0, 1); drawTri ( 150, yoff-10, 150+10, yoff-10, 150, yoff, 0, 1,0, 1); setText ( 1.0, -0.5 ); for (int b=0; b < NUM_BIN; b++ ) { strncpy ( name, binNames[b].c_str(), 128 ); drawText ( 8, yoff + b*25+12, name, 1,1,1,1 ); clr.x = float(f.binChange[b]) / f.totalDraw; if ( clr.x > 1 ) clr.x = 1; sprintf ( msg, "%d", f.binChange[b] ); drawText ( 100, yoff + b*25+12-2, msg, clr.x*0.7+0.3, 0,0,1 ); clr.x = float(f.binSwitch[b]) / f.totalDraw; if ( clr.x > 1 ) clr.x= 1; sprintf ( msg, "%d", f.binSwitch[b] ); drawText ( 125, yoff + b*25+12+2, msg, clr.x*0.7+0.3,clr.x*.4+0.2,0,1 ); clr.x = float(f.binReuse[b]) / f.totalDraw; if ( clr.x > 1 ) clr.x= 1; sprintf ( msg, "%d", f.binReuse[b] ); drawText ( 150, yoff + b*25+12-2, msg, 0, clr.x*0.7+0.3, 0,1 ); sprintf ( msg, "%d", f.binUnique[b] ); drawText ( 175, yoff + b*25+12+2, msg, .7, .7, .7,1 ); } int ys = NUM_BIN*25; float ypos; sprintf ( msg, "%d", mMaxPrim/4 ); drawLine ( 0, yoff + ys+25, 200, yoff+ys+25, .6, .6, .6, 1); drawText ( 10, yoff+ys+25+15, msg, .8,.8,.8,1 ); drawText ( 10, yoff + ys+80, "# Prims", 1, 1, 1, 1 ); drawText ( 10, yoff+ys+125, "0", .8,.8,.8,1 ); drawLine ( 0, yoff + ys+125, 200, yoff+ys+125, .6, .6, .6, 1); ypos = mEvents[ mSelectID ].bin_id[ BIN_DRAW ] * 400 / mMaxPrim; // prim count clr = getClr ( mEvents[ mSelectID ].bin_id[9] + 9*16384 ); if ( ypos > 100 ) ypos = 100; sprintf ( msg, "%d", mEvents[ mSelectID ].bin_id[BIN_DRAW] ); drawLine ( 150, yoff+ys+(125-ypos), 200, yoff+ys+(125-ypos), clr.x,clr.y,clr.z,1 ); drawText ( 150, yoff+ys+(125-ypos), msg, clr.x,clr.y,clr.z,1 ); sprintf ( msg, "%d", mMaxSize ); drawLine ( 0, yoff + ys+150, 200, yoff+ys+150, .6, .6, .6, 1); drawText ( 10, yoff+ys+150+15, msg, .8,.8,.8,1 ); drawText ( 10, yoff + ys+200, "Transfer (bytes)" , 1, 1, 1, 1); drawText ( 10, yoff+ys+250, "0", .8,.8,.8,1 ); drawLine ( 0, yoff + ys+250, 200, yoff+ys+250, .6, .6, .6, 1); ypos = mEvents[ mSelectID ].bin_size [ BIN_SIZE ] * 100 / mMaxSize; // prim count if ( ypos > 100 ) ypos = 100; sprintf ( msg, "%d", mEvents[ mSelectID ].bin_size [BIN_SIZE] ); drawLine ( 150, yoff+ys+(250-ypos), 200, yoff+ys+(250-ypos), 1,1,1,1 ); drawText ( 150, yoff+ys+(250-ypos), msg, 1,1,1,1 ); // Right panel - Call Text drawFill ( xoff, yoff, xoff + panel_width, yoff + NUM_BIN*25+250, 0.15,0.15,0.2,0.75 ); int cid; glColor3f ( 1, 1, 1); for (int c = 0; c < mEvents[ mSelectID ].call_num; c++ ) { cid = mEvents[ mSelectID ].call_start + c; clr = getClr ( mCalls[cid].val_id + mCalls[cid].bin_id*16384 ); clr.w = 1; drawFill ( xoff+100, yoff + c*15, xoff+125, yoff+c*15+13, clr.x, clr.y, clr.z, clr.w ); sprintf ( msg, "%s", mCalls[cid].name.c_str() ); drawText ( xoff+5, yoff + c*15+15, msg, 1,1,1,1 ); sprintf ( msg, "%02d %d %d", mCalls[cid].bin_id, mCalls[cid].size, mCalls[cid].val_id ); drawText ( xoff+130, yoff + c*15+15, msg, 1,1,1,1 ); } end2D (); #ifdef USE_DX g_pContext->OMSetDepthStencilState( g_pDepthStencilState, 1 ); #endif }
void drawMatrix () { Vector3DF id_clr; float ypos, yposl; int b, num = (int) mEvents.size(); Matrix4F proj, view, model; proj.Scale ( 2.0/window_width, -2.0/window_height, 1 ); model.Translate ( cam.getToPos().x, cam.getToPos().y, 1 ); view.Scale ( cam.getToPos().z, 1, 1 ); view *= model; model.Identity (); //----- 2D Drawing (visualizer space) setview2D ( model.GetDataF(), view.GetDataF(), proj.GetDataF() ); setorder2D ( false, 1 ); // Event ID bars static2D (); int fl = -1; char msg[100]; for (int n=0; n < num; n++ ) { if ( mEvents[n].frame != fl ) { sprintf ( msg, "frame %d", mEvents[n].frame ); drawText ( n*10, -2, msg, 1,1,1,1 ); } for (b=0; b < NUM_BIN; b++) { if ( mEvents[n].bin_id[b] == -1 ) { id_clr.Set ( 1, 1, 1 ); } else if ( mEvents[n].bin_change[b] == 0 ) { id_clr.Set ( .2, .2, .2 ); } else { id_clr = getClr ( mEvents[n].bin_id[b] + b*16384 ); } drawFill ( n*10.0, b*25, n*10+10.0, b*25+24, id_clr.x, id_clr.y, id_clr.z, 1 ); } fl = mEvents[n].frame; } end2D (); // Change State bars static2D (); for (int n=0; n < num; n++ ) { for (b=0; b < NUM_BIN; b++) { if ( mEvents[n].bin_id[b] != -1 ) { switch ( mEvents[n].bin_change[b] ) { case BIN_NOTUSED: id_clr.Set ( .2, .2, .2 ); break; case BIN_CREATE: id_clr.Set ( 1, 0, 0 ); break; case BIN_CHANGE: id_clr.Set ( 1, 0, 0 ); break; case BIN_SWITCH: id_clr.Set ( 1, .5, 0 ); break; case BIN_REUSE: id_clr.Set ( 0, 1, 0 ); break; }; drawTri ( n*10, b*25, n*10+10, b*25, n*10, b*25+10, id_clr.x, id_clr.y, id_clr.z, 1 ); } } } end2D (); int ys = NUM_BIN*25; // Prim count bars static2D(); b = BIN_DRAW; for (int n=0; n < num; n++ ) { id_clr = getClr ( mEvents[n].bin_id[9] + 9*16384 ); ypos = mEvents[n].bin_id[ b ] * 400 / mMaxPrim; // prim count if ( ypos > 100 ) ypos = 100; drawFill ( n*10, ys+(125-ypos), n*10+10, ys+125, id_clr.x, id_clr.y, id_clr.z, 1 ); } end2D (); // Mem transfer line static2D(); yposl = 0; b = BIN_SIZE; for (int n=0; n < num; n++ ) { id_clr.Set(1,1,1); ypos = mEvents[n].bin_size[ b ] * 100 / mMaxSize; // size (bytes) if ( ypos > 100 ) ypos = 100; drawLine ( n*10+5, ys+(250-ypos), n*10-5, ys+(250-yposl), 1, 1, 1, 1 ); yposl = ypos; } drawLine ( 5, ys+250, num*10-5, ys+250, .5, .5, .5, 1 ); end2D (); }