MCPcopy Create free account
hub / github.com/ddnet/ddnet / Render

Method Render

src/game/editor/editor.cpp:6290–6617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6288}
6289
6290void CEditor::Render()
6291{
6292 // basic start
6293 Graphics()->Clear(0.0f, 0.0f, 0.0f);
6294 CUIRect View = *Ui()->Screen();
6295 Ui()->MapScreen();
6296 m_CursorType = CURSOR_NORMAL;
6297
6298 float Width = View.w;
6299 float Height = View.h;
6300
6301 // reset tip
6302 str_copy(m_aTooltip, "");
6303
6304 // render checker
6305 RenderBackground(View, m_CheckerTexture, 32.0f, 1.0f);
6306
6307 CUIRect MenuBar, ModeBar, ToolBar, StatusBar, ExtraEditor, ToolBox;
6308 m_ShowPicker = Input()->KeyIsPressed(KEY_SPACE) && m_Dialog == DIALOG_NONE && CLineInput::GetActiveInput() == nullptr && Map()->m_vSelectedLayers.size() == 1;
6309
6310 if(m_GuiActive)
6311 {
6312 View.HSplitTop(16.0f, &MenuBar, &View);
6313 View.HSplitTop(53.0f, &ToolBar, &View);
6314 View.VSplitLeft(m_ToolBoxWidth, &ToolBox, &View);
6315
6316 View.HSplitBottom(16.0f, &View, &StatusBar);
6317 if(!m_ShowPicker && m_ActiveExtraEditor != EXTRAEDITOR_NONE)
6318 View.HSplitBottom(m_aExtraEditorSplits[(int)m_ActiveExtraEditor], &View, &ExtraEditor);
6319 }
6320 else
6321 {
6322 // hack to get keyboard inputs from toolbar even when GUI is not active
6323 ToolBar.x = -100;
6324 ToolBar.y = -100;
6325 ToolBar.w = 50;
6326 ToolBar.h = 50;
6327 }
6328
6329 // a little hack for now
6330 if(m_Mode == MODE_LAYERS)
6331 DoMapEditor(View);
6332
6333 if(m_Dialog == DIALOG_NONE && CLineInput::GetActiveInput() == nullptr)
6334 {
6335 // handle undo/redo hotkeys
6336 if(Ui()->CheckActiveItem(nullptr))
6337 {
6338 if(Input()->KeyPress(KEY_Z) && Input()->ModifierIsPressed() && !Input()->ShiftIsPressed())
6339 ActiveHistory().Undo();
6340 if((Input()->KeyPress(KEY_Y) && Input()->ModifierIsPressed()) || (Input()->KeyPress(KEY_Z) && Input()->ModifierIsPressed() && Input()->ShiftIsPressed()))
6341 ActiveHistory().Redo();
6342 }
6343
6344 // handle brush save/load hotkeys
6345 for(int i = KEY_1; i <= KEY_0; i++)
6346 {
6347 if(Input()->KeyPress(i))

Callers 2

DoMapEditorMethod · 0.45
RenderEditorMapMethod · 0.45

Calls 15

GraphicsFunction · 0.85
UiFunction · 0.85
InputFunction · 0.85
MapFunction · 0.85
dbg_msgFunction · 0.85
CTextureHandleClass · 0.85
HasUnsavedDataFunction · 0.85
fs_split_file_extensionFunction · 0.85
fs_filenameFunction · 0.85
MapViewFunction · 0.85
ScreenMethod · 0.80
KeyIsPressedMethod · 0.80

Tested by

no test coverage detected