Skip to content

Commit

Permalink
V1
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreEVEN committed Mar 26, 2021
1 parent be43f03 commit d453285
Show file tree
Hide file tree
Showing 11 changed files with 465 additions and 183 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_subdirectory(Tools)

#Set startup project
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Visualizer)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT SuperPacker)

#set project name
project(SuperPacker)
Expand Down
Binary file added Roboto-Medium.ttf
Binary file not shown.
2 changes: 1 addition & 1 deletion Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

add_subdirectory(Visualizer)
add_subdirectory(SuperPacker)
add_subdirectory(ThirdParty)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,25 @@
#include "imgui.h"
#include "SuperPacker.h"

#include <windows.h>

int main(int argc, char** argv)
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
//int main(int argc, char** argv)
{
OpenGLContext::Init();



while (!OpenGLContext::ShouldClose()) {
OpenGLContext::BeginFrame();

if (ImGui::BeginMainMenuBar())
{
if (ImGui::BeginMenu("file")) {
if (ImGui::MenuItem("Close"))
{
OpenGLContext::request_close();
}
ImGui::EndMenu();
}



ImGui::EndMainMenuBar();
}


int size_x, size_y;
OpenGLContext::GetWindowSize(size_x, size_y);

ImGui::SetNextWindowPos(ImVec2(0, 20));
ImGui::SetNextWindowSize(ImVec2(static_cast<float>(size_x), static_cast<float>(size_y) - 20));
ImGui::SetNextWindowPos(ImVec2(0, 0));
ImGui::SetNextWindowSize(ImVec2(static_cast<float>(size_x), static_cast<float>(size_y)));

if (ImGui::Begin("background_window", nullptr, ImGuiWindowFlags_NoDecoration))
if (ImGui::Begin("background_window", nullptr, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoBringToFrontOnFocus))
{
SuperPacker::draw_ui();
}
Expand All @@ -44,4 +31,6 @@ int main(int argc, char** argv)
}

OpenGLContext::Shutdown();

return 0;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "OpenGLContext.h"


#include <filesystem>
#include <iostream>

#include "GL/gl3w.h"
Expand Down Expand Up @@ -41,7 +43,7 @@ void OpenGLContext::Init() {
glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);
glfwWindowHint(GLFW_MAXIMIZED, GLFW_FALSE);

WindowHandle = glfwCreateWindow(1000, 1000, "Pure3D - OpenGL", 0, 0);
WindowHandle = glfwCreateWindow(1000, 500, "Super packer - OpenGL", 0, 0);
if (!WindowHandle) std::cerr << "Failed to create Glfw window handle" << std::endl;
glfwMakeContextCurrent(WindowHandle);
glfwSetFramebufferSizeCallback(WindowHandle, &ResizeCallback);
Expand Down Expand Up @@ -70,6 +72,16 @@ void OpenGLContext::Init() {
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
io.IniFilename = NULL;

auto& style = ImGui::GetStyle();
style.WindowBorderSize = 0;
style.FramePadding = ImVec2(20, 10);

if (std::filesystem::exists("Roboto-Medium.ttf")) {
io.Fonts->AddFontFromFileTTF("Roboto-Medium.ttf", 20.f);
}

//io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
ImGui::StyleColorsDark();

Expand Down
Loading

0 comments on commit d453285

Please sign in to comment.