git repos / blockattack-game

blame: source/code/SagoImGui.cpp

normal view · raw

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