Lib Import & CMake & init window code
This commit is contained in:
36
Osmium.cpp
36
Osmium.cpp
@@ -1,25 +1,59 @@
|
||||
#include <iostream>
|
||||
#include <glad/glad.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include "config.h"
|
||||
#include <imgui.h>
|
||||
#include <imgui_impl_glfw.h>
|
||||
#include <imgui_impl_opengl3.h>
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
std::cout << "Hello working!" << std::endl;
|
||||
|
||||
IMGUI_CHECKVERSION();
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||
ImGui::StyleColorsDark();
|
||||
|
||||
|
||||
glfwInit();
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||
glfwWindowHint(GLFW_DECORATED, GLFW_FALSE);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
|
||||
|
||||
GLFWwindow *window = glfwCreateWindow(640, 480, "OpenGL Demo", NULL, NULL);
|
||||
if (!window) {
|
||||
|
||||
std::cout << "Failed to create GLFW window." << std::endl;
|
||||
glfwTerminate();
|
||||
|
||||
|
||||
ImGui_ImplOpenGL3_NewFrame();
|
||||
ImGui_ImplGlfw_NewFrame();
|
||||
ImGui::NewFrame();
|
||||
|
||||
ImGui::BeginMainMenuBar();
|
||||
if (ImGui::BeginMenu("File")) {
|
||||
ImGui::MenuItem("Exit");
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::EndMainMenuBar();
|
||||
|
||||
ImGui::Begin("Editor");
|
||||
ImGui::Text("Hello from editor");
|
||||
ImGui::End();
|
||||
|
||||
ImGui::Render();
|
||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||
glfwSwapBuffers(window);
|
||||
|
||||
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
|
||||
gladLoadGL();
|
||||
|
||||
Reference in New Issue
Block a user