Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
José Pardo Madera
/
pag_practicas_2025
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f1733fdc
authored
Sep 17, 2025
by
José Pardo Madera
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Creado singleton GUI
parent
77ad0f12
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
0 deletions
gui.cpp
gui.h
main.cpp
gui.cpp
0 → 100644
View file @
f1733fdc
#include "gui.h"
#include <imgui.h>
#include <imgui_impl_glfw.h>
#include <imgui_impl_opengl3.h>
namespace
PAG
{
GUI
&
GUI
::
getInstance
()
{
static
GUI
instance
;
return
instance
;
}
void
GUI
::
init
(
GLFWwindow
*
window
)
{
IMGUI_CHECKVERSION
();
ImGui
::
CreateContext
();
ImGuiIO
&
io
=
ImGui
::
GetIO
();
io
.
ConfigFlags
|=
ImGuiConfigFlags_NavEnableKeyboard
;
ImGui_ImplGlfw_InitForOpenGL
(
window
,
true
);
ImGui_ImplOpenGL3_Init
();
}
void
GUI
::
shutdown
()
{
ImGui_ImplOpenGL3_Shutdown
();
ImGui_ImplGlfw_Shutdown
();
ImGui
::
DestroyContext
();
}
GUI
::
GUI
()
{};
}
gui.h
0 → 100644
View file @
f1733fdc
#pragma once
#include "glad/glad.h"
#include <GLFW/glfw3.h>
namespace
PAG
{
class
GUI
{
public
:
static
GUI
&
getInstance
();
GUI
(
const
GUI
&
)
=
delete
;
void
operator
=
(
const
GUI
&
)
=
delete
;
void
init
(
GLFWwindow
*
);
void
shutdown
();
private
:
GUI
();
};
};
main.cpp
View file @
f1733fdc
...
...
@@ -6,6 +6,7 @@
#include <GLFW/glfw3.h>
#include "renderer.h"
#include "gui.h"
// Helper que muestra un mensaje y cierra el programa
#define panic(message) { \
...
...
@@ -107,6 +108,8 @@ int main() {
panic
(
"GLAD initialization failed"
);
}
PAG
::
GUI
::
getInstance
().
init
(
window
);
auto
&
renderer
=
PAG
::
Renderer
::
getInstance
();
std
::
cout
<<
renderer
.
getRendererName
()
<<
std
::
endl
;
...
...
@@ -135,6 +138,7 @@ int main() {
std
::
cout
<<
"Finishing application pag prueba"
<<
std
::
endl
;
PAG
::
GUI
::
getInstance
().
shutdown
();
glfwDestroyWindow
(
window
);
glfwTerminate
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment