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

Method RenderMenubar

src/game/editor/editor.cpp:6197–6279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6195}
6196
6197void CEditor::RenderMenubar(CUIRect MenuBar)
6198{
6199 SPopupMenuProperties PopupProperties;
6200 PopupProperties.m_Corners = IGraphics::CORNER_R | IGraphics::CORNER_B;
6201
6202 CUIRect FileButton;
6203 static int s_FileButton = 0;
6204 MenuBar.VSplitLeft(60.0f, &FileButton, &MenuBar);
6205 if(DoButton_Ex(&s_FileButton, "File", 0, &FileButton, BUTTONFLAG_LEFT, nullptr, IGraphics::CORNER_T, EditorFontSizes::MENU, TEXTALIGN_ML))
6206 {
6207 static SPopupMenuId s_PopupMenuFileId;
6208 Ui()->DoPopupMenu(&s_PopupMenuFileId, FileButton.x, FileButton.y + FileButton.h - 1.0f, 120.0f, 188.0f, this, PopupMenuFile, PopupProperties);
6209 }
6210
6211 MenuBar.VSplitLeft(5.0f, nullptr, &MenuBar);
6212
6213 CUIRect ToolsButton;
6214 static int s_ToolsButton = 0;
6215 MenuBar.VSplitLeft(60.0f, &ToolsButton, &MenuBar);
6216 if(DoButton_Ex(&s_ToolsButton, "Tools", 0, &ToolsButton, BUTTONFLAG_LEFT, nullptr, IGraphics::CORNER_T, EditorFontSizes::MENU, TEXTALIGN_ML))
6217 {
6218 static SPopupMenuId s_PopupMenuToolsId;
6219 Ui()->DoPopupMenu(&s_PopupMenuToolsId, ToolsButton.x, ToolsButton.y + ToolsButton.h - 1.0f, 200.0f, 78.0f, this, PopupMenuTools, PopupProperties);
6220 }
6221
6222 MenuBar.VSplitLeft(5.0f, nullptr, &MenuBar);
6223
6224 CUIRect SettingsButton;
6225 static int s_SettingsButton = 0;
6226 MenuBar.VSplitLeft(60.0f, &SettingsButton, &MenuBar);
6227 if(DoButton_Ex(&s_SettingsButton, "Settings", 0, &SettingsButton, BUTTONFLAG_LEFT, nullptr, IGraphics::CORNER_T, EditorFontSizes::MENU, TEXTALIGN_ML))
6228 {
6229 static SPopupMenuId s_PopupMenuSettingsId;
6230 Ui()->DoPopupMenu(&s_PopupMenuSettingsId, SettingsButton.x, SettingsButton.y + SettingsButton.h - 1.0f, 280.0f, 148.0f, this, PopupMenuSettings, PopupProperties);
6231 }
6232
6233 CUIRect ChangedIndicator, Info, Help, Close;
6234 MenuBar.VSplitLeft(5.0f, nullptr, &MenuBar);
6235 MenuBar.VSplitLeft(MenuBar.h, &ChangedIndicator, &MenuBar);
6236 MenuBar.VSplitRight(15.0f, &MenuBar, &Close);
6237 MenuBar.VSplitRight(5.0f, &MenuBar, nullptr);
6238 MenuBar.VSplitRight(15.0f, &MenuBar, &Help);
6239 MenuBar.VSplitRight(5.0f, &MenuBar, nullptr);
6240 MenuBar.VSplitLeft(MenuBar.w * 0.6f, &MenuBar, &Info);
6241 MenuBar.VSplitRight(5.0f, &MenuBar, nullptr);
6242
6243 if(Map()->m_Modified)
6244 {
6245 TextRender()->SetFontPreset(EFontPreset::ICON_FONT);
6246 TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_PIXEL_ALIGNMENT | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE);
6247 Ui()->DoLabel(&ChangedIndicator, FontIcon::CIRCLE, 8.0f, TEXTALIGN_MC);
6248 TextRender()->SetRenderFlags(0);
6249 TextRender()->SetFontPreset(EFontPreset::DEFAULT_FONT);
6250 static int s_ChangedIndicator;
6251 DoButtonLogic(&s_ChangedIndicator, 0, &ChangedIndicator, BUTTONFLAG_NONE, "This map has unsaved changes."); // just for the tooltip, result unused
6252 }
6253
6254 char aBuf[IO_MAX_PATH_LENGTH + 32];

Callers

nothing calls this directly

Calls 15

UiFunction · 0.85
MapFunction · 0.85
TextRenderFunction · 0.85
str_formatFunction · 0.85
str_timestamp_formatFunction · 0.85
MapViewFunction · 0.85
VSplitLeftMethod · 0.80
DoPopupMenuMethod · 0.80
VSplitRightMethod · 0.80
SetRenderFlagsMethod · 0.80
DoLabelMethod · 0.80
MouseWorldXMethod · 0.80

Tested by

no test coverage detected