void CEditor::DrawEditor() { if (current_object == 3) { // we have selected to work with collisionboxes, draw them. for (unsigned int x = 0; x < zoneToEdit->CollisionMap.size(); x++) { if (objectedit_selected == (signed int)x) { // if we have a selected collisionbox, draw it a little brighter than the others. glColor4f(0.9f, 0.2f, 0.8f,0.8f); } else { glColor4f(0.7f, 0.1f, 0.6f, 0.8f); } DrawingHelpers::mapTextureToRect( interfacetexture.getTexture(4), zoneToEdit->CollisionMap[x].CR.x, zoneToEdit->CollisionMap[x].CR.w, zoneToEdit->CollisionMap[x].CR.y, zoneToEdit->CollisionMap[x].CR.h ); glColor4f(1.0f,1.0f,1.0f,1.0f); } // draw interaction regions std::vector<InteractionRegion*> zoneInteractionRegions = zoneToEdit->getInteractionRegions(); for ( size_t curInteractionRegionNr = 0; curInteractionRegionNr < zoneInteractionRegions.size(); ++curInteractionRegionNr ) { InteractionRegion *curInteractionRegion = zoneInteractionRegions[ curInteractionRegionNr ]; int left, bottom, width, height; curInteractionRegion->getPosition( left, bottom, width, height ); if ( ! DrawingHelpers::isRectOnScreen(left-4, width+8, bottom-4, height+8) ) { continue; } // draw border around the region glColor4f( 0.0f, 0.8f, 0.0f, 0.6f ); DrawingHelpers::mapTextureToRect( interfacetexture.getTexture(4), left, width, bottom, height ); // draw region if ( width > 8 && height > 8 ) { glColor4f( 0.0f, 0.3f, 0.0f, 0.6f ); DrawingHelpers::mapTextureToRect( interfacetexture.getTexture(4), left+4, width-8, bottom+4, height-8 ); } // draw text for region if ( width > 28 and height > tinyFont->getHeight() * 3 + 8 ) { glColor4f(1.0f,1.0f,1.0f,1.0f); std::string curEnterText = curInteractionRegion->getOnEnterText(); std::string curLeaveText = curInteractionRegion->getOnLeaveText(); bool printEnterAndLeaveText = ( curEnterText.size() > 0 && curLeaveText.size() > 0 && height > tinyFont->getHeight() * 6 ); if ( curEnterText.size() > 0 ) { std::string printText = std::string("Enter:\n").append(curEnterText); int printHeight = height - 8; int printBottom = bottom + 4; if ( printEnterAndLeaveText ) { printBottom = printBottom - 4 + height - height/2; printHeight = (height-8) / 2; } printShortText( tinyFont, printText, left + 4, width - 8, printBottom, printHeight ); } if ( curLeaveText.size() > 0 ) { std::string printText = std::string("Leave:\n").append(curLeaveText); int printHeight = height - 8; int printBottom = bottom + 4; if ( printEnterAndLeaveText ) { printHeight = (height-8) / 2; } printShortText( tinyFont, printText, left + 4, width - 8, printBottom, printHeight ); } } } // NPCs. Show wander radius std::vector<CNPC*> npcs = zoneToEdit->getNPCs(); for ( size_t curNPCNr=0; curNPCNr<npcs.size(); ++curNPCNr ) { CNPC *curNPC = npcs[ curNPCNr ]; int wanderRadius = curNPC->getWanderRadius(); double rootX = curNPC->x_spawn_pos + curNPC->getWidth() / 2; double rootY = curNPC->y_spawn_pos + curNPC->getHeight() / 2; double collisionRadius = wanderRadius + 0.5*sqrt( curNPC->getWidth()*curNPC->getWidth() + curNPC->getHeight()*curNPC->getHeight() ); glColor4f( 0.0f, 0.0f, 0.5f, 0.4f ); DrawingHelpers::mapTextureToRect( interfacetexture.getTexture( 5 ), rootX-collisionRadius, 2*collisionRadius, rootY-collisionRadius, 2*collisionRadius ); } } glColor4f(1.0f, 1.0f, 1.0f, 1.0f); if (objectedit_selected >= 0) { // we have selected an object to edit it's properties, show the edit-screen. switch (current_object) { case 1: DrawEditFrame(&(zoneToEdit->EnvironmentMap[objectedit_selected])); break; case 2: DrawEditFrame(&(zoneToEdit->ShadowMap[objectedit_selected])); break; case 3: break; } } // quad on the top, baseframe for the object-selection. DrawingHelpers::mapTextureToRect( interfacetexture.getTexture(0), editorFocus->getX(), Configuration::screenWidth, editorFocus->getY()+Configuration::screenHeight-100, 100 ); // quad on bottom, baseframe for our helptext. DrawingHelpers::mapTextureToRect( interfacetexture.getTexture(0), editorFocus->getX(), Configuration::screenWidth, editorFocus->getY(), 100 ); int fontHeight = keybindingFont->getHeight(); // display our general help text for the editor. glColor4f(1.0f,1.0f,0.13f,1.0f); // set yellow as font color keybindingFont->drawText(editorFocus->getX()+10, editorFocus->getY()+90 - fontHeight, "[ Scoll Up/Down ] Select previous/next object"); keybindingFont->drawText(editorFocus->getX()+10, editorFocus->getY()+80 - fontHeight, "[ F1 ] Next set of objects"); keybindingFont->drawText(editorFocus->getX()+10, editorFocus->getY()+70 - fontHeight, "[ DEL ] Delete object at mouse position"); keybindingFont->drawText(editorFocus->getX()+10, editorFocus->getY()+60 - fontHeight, "[ ENTER ] Place object at mouse position"); keybindingFont->drawText(editorFocus->getX()+10, editorFocus->getY()+50 - fontHeight, "[ S ] Saves the changes into zone1-files"); keybindingFont->drawText(editorFocus->getX()+10, editorFocus->getY()+40 - fontHeight, "[ O ] Load a different zone (not yet implemented)"); keybindingFont->drawText(editorFocus->getX()+10, editorFocus->getY()+30 - fontHeight, "[ L ] Exit the editor"); keybindingFont->drawText(editorFocus->getX()+10, editorFocus->getY()+20 - fontHeight, "//Press the left mouse button near the sides to scroll around ;-)"); // if we have a selected object, display specific help text for it if (objectedit_selected >= 0) { glColor4f(0.5f,1.0f,0.5f,1.0f); keybindingFont->drawText(editorFocus->getX()+500, editorFocus->getY()+90 - fontHeight, "[ UP, DOWN, LEFT, RIGHT ] Move the object"); keybindingFont->drawText(editorFocus->getX()+500, editorFocus->getY()+80 - fontHeight, "[ Left Shift + UP, DOWN, LEFT, RIGHT ] Change scale of object"); keybindingFont->drawText(editorFocus->getX()+500, editorFocus->getY()+70 - fontHeight, "[ . ] Increase transparency"); keybindingFont->drawText(editorFocus->getX()+500, editorFocus->getY()+60 - fontHeight, "[ , ] Decrease transparency"); keybindingFont->drawText(editorFocus->getX()+500, editorFocus->getY()+50 - fontHeight, "[ 1/2/3 ] Increase color RED/GREEN/BLUE"); keybindingFont->drawText(editorFocus->getX()+500, editorFocus->getY()+40 - fontHeight, "[ Left Shift + 1/2/3 ] Decrease color RED/GREEN/BLUE)"); keybindingFont->drawText(editorFocus->getX()+500, editorFocus->getY()+30 - fontHeight, "[ b/n ] Increase / decrease Z-position"); } glColor4f(1.0f,1.0f,1.0f,1.0f); // and back to white. DrawingHelpers::mapTextureToRect( interfacetexture.getTexture(1), editorFocus->getX()+(Configuration::screenWidth/2)-5, 50, editorFocus->getY()+Configuration::screenHeight-65, 50 ); glBegin(GL_LINES); glTexCoord2f(0.0f, 0.0f); glVertex3f(mouseX-20+editorFocus->getX(), mouseY+editorFocus->getY(), 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(mouseX+20+editorFocus->getX(), mouseY+editorFocus->getY(), 0.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(mouseX+editorFocus->getX(), mouseY+20+editorFocus->getY(), 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(mouseX+editorFocus->getX(), mouseY-20+editorFocus->getY(), 0.0f); glEnd(); TileSet* tileSet = EditorInterface::getTileSet(); std::vector<Tile*> curTiles; switch (current_object) { case 0: // draw all tileset tiles in edit frame curTiles = tileSet->getAllTilesOfType( TileClassificationType::FLOOR ); break; case 1: // draw all environment objects in edit frame curTiles = tileSet->getAllTilesOfType( TileClassificationType::ENVIRONMENT ); break; case 2: // draw all available shadows in edit frame curTiles = tileSet->getAllTilesOfType( TileClassificationType::SHADOW ); break; case 4: // we have selected to work with NPCs, draw their bases for ( size_t curNPC = 0; curNPC < editorNPCs.size(); curNPC++ ) { int npcWidth = editorNPCs[ curNPC ].second->getTexture( ActivityType::Walking )->getTexture( 5 ).width; int npcHeight = editorNPCs[ curNPC ].second->getTexture( ActivityType::Walking )->getTexture( 5 ).height; DrawingHelpers::mapTextureToRect( editorNPCs[ curNPC ].second->getTexture( ActivityType::Walking )->getTexture( 5 ), editorFocus->getX()+(Configuration::screenWidth/2)+(curNPC*50)+(tilepos_offset*50)-48+20, npcWidth, editorFocus->getY()+Configuration::screenHeight-40-48, npcHeight ); }; keybindingFont->drawText( editorFocus->getX()+(Configuration::screenWidth/2)-5, editorFocus->getY()+Configuration::screenHeight-90, editorNPCs[ current_tilepos ].first ); keybindingFont->drawText( editorFocus->getX()+(Configuration::screenWidth/2)-5, editorFocus->getY()+Configuration::screenHeight-100, "Level: %d (%s)", editorNPCs[ current_tilepos ].second->getLevel(), CharacterClass::getCharacterClassName( editorNPCs[ current_tilepos ].second->getClass() ).c_str() ); break; } for ( tilepos=0; tilepos<curTiles.size(); ++tilepos ) { Tile *curTile = curTiles[ tilepos ]; DrawingHelpers::mapTextureToRect( curTile->texture->getTexture(0), editorFocus->getX()+(Configuration::screenWidth/2)+(tilepos*50)+(tilepos_offset*50), 40, editorFocus->getY()+Configuration::screenHeight-60, 40 ); } /// draw the world position of the mouse in the top left corner. keybindingFont->drawText( editorFocus->getX()+10, editorFocus->getY()+Configuration::screenHeight-10, "x: %d, y: %d", int(editorFocus->getX())+mouseX, int(editorFocus->getY())+mouseY ); }
HBRUSH CBorderStyleEdit::CtlColor(CDC* pDC, UINT /*nCtlColor*/) { DrawEditFrame( pDC ); return m_BgBrush; }