VOID GRAPHBOARD::DrawPMMark( const HPS hps, const char Row, const char Col ) { POINTL Point; ULONG Bitmap; HBITMAP hbm; if( GetDiscovered( Row, Col ) != -1 ) return; if( GetMarked( Row, Col ) ) Bitmap = BMP_UNMARK; else Bitmap = BMP_MARK; Point.x = LowerLeftPlace.x + (Col - 1)*dist - dist/6; Point.y = LowerLeftPlace.y + (Row - 1)*dist - dist/6; hbm = GpiLoadBitmap( hps, (HMODULE)NULL, Bitmap, dist/3, dist/3); // if( hbm == NULLHANDLE ) DosBeep( 500, 150 ); // if( !(WinDrawBitmap( hps, hbm, NULL, &Point, 0, 0, DBM_NORMAL ) )) // DosBeep( 1000, 150 ); WinDrawBitmap(hps, hbm, NULL, &Point, 0, 0, DBM_NORMAL); GpiDeleteBitmap( hbm ); // releases the bitmap-handle ToggleMarked( Row, Col ); }
void RangeDrawer::ToggleMarkedTerrainCoord(const float &tx, const float &ty) { ToggleMarked( TerrainX2QuadX(tx), TerrainY2QuadY(ty) ); }
VOID GRAPHBOARD::DrawPMBoard( const HPS hps ) { POINTL StartHor = LowerLeftPlace; POINTL EndHor; POINTL StartVert = LowerLeftPlace; POINTL EndVert; int Value; EndHor.x = StartHor.x + (Columns - 3) * dist; // shown cols = Columns - 2 EndHor.y = StartHor.y; EndVert.x = StartVert.x; EndVert.y = StartVert.y + (Rows - 3) * dist; GpiSetColor( hps, CLR_BLACK ); GpiSetLineType( hps, LINETYPE_SOLID ); GpiSetLineWidth( hps, LINEWIDTH_NORMAL ); if( !InfoData.IsLineStyle(IDC_DIAGONALS) ){ // first we paint the horizontal lines: for( ; StartHor.y <= EndVert.y; StartHor.y += dist, EndHor.y += dist ){ GpiMove( hps, &StartHor ); GpiLine( hps, &EndHor ); } // then the vertical lines: for(; StartVert.x <= EndHor.x; StartVert.x += dist, EndVert.x += dist ){ GpiMove( hps, &StartVert ); GpiLine( hps, &EndVert ); } } // end if !InfoData.IsLineStyle( IDC_DIAGONALS ) DosSleep( 1 ); // free time slice if( !InfoData.IsLineStyle(IDC_VERTICALS) ){ // there are still some diagonals left: // Start... draw from left top to right bottom GpiSetLineType( hps, LINETYPE_DOT ); StartVert.x = LowerLeftPlace.x; StartVert.y = LowerLeftPlace.y + dist; StartHor.x = LowerLeftPlace.x + dist; StartHor.y = LowerLeftPlace.y; // End... draw from right top to left bottom EndVert.x = LowerLeftPlace.x + ( Columns - 3) * dist; EndVert.y = LowerLeftPlace.y + dist; EndHor.x = LowerLeftPlace.x + ( Columns - 4) * dist; EndHor.y = LowerLeftPlace.y; int VertBreak = 0; int HorBreak = 0; while( StartVert.x != StartHor.x || StartVert.y != StartHor.y ) { GpiMove( hps, &StartHor ); GpiLine( hps, &StartVert ); GpiMove( hps, &EndHor ); GpiLine( hps, &EndVert ); if( VertBreak ){ StartVert.x += dist; EndVert.x -= dist; } else { StartVert.y += dist; EndVert.y += dist; if( StartVert.y == LowerLeftPlace.y + (Rows - 3)*dist) VertBreak = 1; } if( HorBreak ){ StartHor.y += dist; EndHor.y += dist; } else { StartHor.x += dist; EndHor.x -= dist; if( StartHor.x == LowerLeftPlace.x + (Columns - 3 ) * dist ) HorBreak = 1; } } } // end if !InfoData.IsLineStyle( IDC_VERTICALS ) DosSleep( 1 ); // free time slice // now we insert the values that have already been discovered for( char i = 1; i < Rows - 1; i++ ){ for( char j = 1; j < Columns - 1; j++ ){ if( (Value = GetDiscovered( i, j) ) != -1 ){ DrawPMPlace( hps, i, j, Value, FALSE ); } else { ToggleMarked( i, j ); DrawPMMark( hps, i, j ); } } // for j DosSleep( 1 ); // free timeslice } // for i }