Add Vapp
This commit is contained in:
parent
3651d07750
commit
1cf439ef03
@ -51,7 +51,7 @@ target_include_directories(server PRIVATE server/inc shared/inc)
|
|||||||
|
|
||||||
add_executable(view
|
add_executable(view
|
||||||
view/src/main.cpp
|
view/src/main.cpp
|
||||||
|
view/src/Vapp.cpp
|
||||||
shared/src/canvas/BackGround.cpp
|
shared/src/canvas/BackGround.cpp
|
||||||
shared/src/canvas/BackGroundColors.cpp
|
shared/src/canvas/BackGroundColors.cpp
|
||||||
shared/src/canvas/Canvas.cpp
|
shared/src/canvas/Canvas.cpp
|
||||||
|
13
view/inc/Vapp.hpp
Normal file
13
view/inc/Vapp.hpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
class Vapp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void init();
|
||||||
|
void update();
|
||||||
|
void draw();
|
||||||
|
void deinit();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool showDemoWindow;
|
||||||
|
};
|
43
view/src/Vapp.cpp
Normal file
43
view/src/Vapp.cpp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#include <cinttypes>
|
||||||
|
|
||||||
|
#include "Vapp.hpp"
|
||||||
|
#include "values/Dna.hpp"
|
||||||
|
|
||||||
|
#include <rlImGui.h>
|
||||||
|
#include <imgui.h>
|
||||||
|
#include <raylib.h>
|
||||||
|
|
||||||
|
void Vapp::init()
|
||||||
|
{
|
||||||
|
// TraceLog(LOG_INFO, "%d / %d = %d", sizeof(Dna), sizeof(int64_t), sizeof(Dna) / sizeof(int64_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Vapp::update()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Vapp::draw()
|
||||||
|
{
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
ImGui::DockSpaceOverViewport(0, NULL, ImGuiDockNodeFlags_PassthruCentralNode);
|
||||||
|
|
||||||
|
if (ImGui::BeginMainMenuBar())
|
||||||
|
{
|
||||||
|
if (ImGui::BeginMenu("Window"))
|
||||||
|
{
|
||||||
|
if (ImGui::MenuItem("Demo Window", nullptr, showDemoWindow))
|
||||||
|
showDemoWindow = !showDemoWindow;
|
||||||
|
|
||||||
|
ImGui::EndMenu();
|
||||||
|
}
|
||||||
|
ImGui::EndMainMenuBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showDemoWindow)
|
||||||
|
ImGui::ShowDemoWindow(&showDemoWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Vapp::deinit()
|
||||||
|
{
|
||||||
|
}
|
@ -2,50 +2,34 @@
|
|||||||
#include <raylib.h>
|
#include <raylib.h>
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
#include <rlImGui.h>
|
#include <rlImGui.h>
|
||||||
|
#include "Vapp.hpp"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int screenWidth = 800;
|
int screenWidth = 800;
|
||||||
int screenHeight = 800;
|
int screenHeight = 800;
|
||||||
|
|
||||||
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
|
Vapp app;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "VIEW");
|
InitWindow(screenWidth, screenHeight, "VIEW");
|
||||||
SetTargetFPS(60);
|
SetTargetFPS(60);
|
||||||
rlImGuiSetup(true);
|
rlImGuiSetup(true);
|
||||||
|
app.init();
|
||||||
bool showDemoWindow = true;
|
bool showDemoWindow = true;
|
||||||
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
||||||
|
|
||||||
while (!WindowShouldClose())
|
while (!WindowShouldClose())
|
||||||
{
|
{
|
||||||
|
app.update();
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
rlImGuiBegin();
|
rlImGuiBegin();
|
||||||
|
app.draw();
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
|
|
||||||
ImGui::DockSpaceOverViewport(0, NULL, ImGuiDockNodeFlags_PassthruCentralNode);
|
|
||||||
|
|
||||||
if (ImGui::BeginMainMenuBar())
|
|
||||||
{
|
|
||||||
if (ImGui::BeginMenu("Window"))
|
|
||||||
{
|
|
||||||
if (ImGui::MenuItem("Demo Window", nullptr, showDemoWindow))
|
|
||||||
showDemoWindow = !showDemoWindow;
|
|
||||||
|
|
||||||
ImGui::EndMenu();
|
|
||||||
}
|
|
||||||
ImGui::EndMainMenuBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showDemoWindow)
|
|
||||||
ImGui::ShowDemoWindow(&showDemoWindow);
|
|
||||||
|
|
||||||
|
|
||||||
rlImGuiEnd();
|
rlImGuiEnd();
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
}
|
}
|
||||||
|
app.deinit();
|
||||||
rlImGuiShutdown();
|
rlImGuiShutdown();
|
||||||
CloseWindow();
|
CloseWindow();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user