-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
97 lines (73 loc) · 2.1 KB
/
Copy pathmain.cpp
File metadata and controls
97 lines (73 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include "./GUI/feathergui.h"
//#define DEBUG
static void glfw_error_callback(int error, const char* description)
{
fprintf(stderr, "Glfw Error %d: %s\n", error, description);
}
#ifndef DEBUG
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow)
{
glfwSetErrorCallback(glfw_error_callback);
GLFWwindow* window;
const char* glsl_version = "#version 130";
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
if (!glfwInit())
{
return -1;
}
window = glfwCreateWindow(1280, 720, "", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
glfwSwapInterval(1); // Enable vsync
//Icon Path and Load image
std::string icon_path = getCurrentNormalizedPath() + ICONPATH;
int icon_x, icon_y, icon_nrChannels;
unsigned char* icon_pixels = stbi_load(icon_path.c_str(), &icon_x, &icon_y, &icon_nrChannels, 4);
//Create GLFW Image
GLFWimage GLicon[1];
GLicon[0].pixels = icon_pixels;
GLicon[0].width = icon_x;
GLicon[0].height = icon_y;
//change window icon
glfwSetWindowIcon(window, 1, GLicon);
//Set title of the window
glfwSetWindowTitle(window, "Feather");
//Make it fullscreen
//glfwSetWindowMonitor(window, glfwGetPrimaryMonitor(), 0, 0, 1920, 1080, GLFW_DONT_CARE);
//Make the windows maximized
glfwMaximizeWindow(window);
//Create the GUI
FeatherGUI gui(window, glsl_version);
while (!glfwWindowShouldClose(window) && gui.IsOpened())
{
glfwPollEvents();
gui.InitGUI();
gui.BuildGUI();
int display_w, display_h;
glfwGetFramebufferSize(window, &display_w, &display_h);
glViewport(0, 0, display_w, display_h);
glClearColor(
(GLclampf)(gui.GetBackGroundColor().r / 255.0F),
(GLclampf)(gui.GetBackGroundColor().g / 255.0F),
(GLclampf)(gui.GetBackGroundColor().b / 255.0F),
(GLclampf)(gui.GetBackGroundColor().delta / 255.0F));
glClear(GL_COLOR_BUFFER_BIT);
gui.RenderGUI();
glfwSwapBuffers(window);
}
glfwTerminate();
return 0;
}
#endif
#ifdef DEBUG
#include <shlobj.h> // Incluir la librería shell32.lib
int main()
{
return 0;
}
#endif