Skip to content

Commit d488281

Browse files
committed
Initial ImGui for the puzzle editor in the future. This breaks Ubuntu 20.04, so it might take some time to make it to master.
1 parent 1193b4b commit d488281

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

source/code/SagoImGui.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
===========================================================================
3+
* Sago Multi Scrambler Puzzle
4+
Copyright (C) 2024 Poul Sander
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 2 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see http://www.gnu.org/licenses/
18+
19+
Source information and contacts persons can be found at
20+
https://github.com/sago007/sago_multi_scrambler_puzzle2
21+
===========================================================================
22+
*/
23+
24+
#include "SagoImGui.hpp"
25+
26+
27+
28+
void InitImGui(SDL_Window* window, SDL_Renderer* renderer, int width, int height) {
29+
// Setup Dear ImGui context
30+
IMGUI_CHECKVERSION();
31+
ImGui::CreateContext();
32+
ImGuiIO& io = ImGui::GetIO(); (void)io;
33+
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
34+
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
35+
io.DisplaySize.x = static_cast<float>(width);
36+
io.DisplaySize.y = static_cast<float>(height);
37+
38+
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
39+
40+
// Setup Dear ImGui style
41+
ImGui::StyleColorsDark();
42+
//ImGui::StyleColorsLight();
43+
44+
// Setup Platform/Renderer backends
45+
ImGui_ImplSDL2_InitForSDLRenderer(window, renderer);
46+
ImGui_ImplSDLRenderer2_Init(renderer);
47+
}

source/code/SagoImGui.hpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
===========================================================================
3+
* Sago Multi Scrambler Puzzle
4+
Copyright (C) 2024 Poul Sander
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 2 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see http://www.gnu.org/licenses/
18+
19+
Source information and contacts persons can be found at
20+
https://github.com/sago007/sago_multi_scrambler_puzzle2
21+
===========================================================================
22+
*/
23+
24+
#include "imgui.h"
25+
#include "backends/imgui_impl_sdl2.h"
26+
#include "backends/imgui_impl_sdlrenderer2.h"
27+
#include <SDL2/SDL.h>
28+
#include <SDL2/SDL_image.h>
29+
30+
31+
32+
void InitImGui(SDL_Window* window, SDL_Renderer* renderer, int width, int height);

0 commit comments

Comments
 (0)