Skip to content
Snippets Groups Projects
Commit 9a10a476 authored by Philip Trettner's avatar Philip Trettner
Browse files

prepared live3

parent e00ef402
Branches
No related tags found
No related merge requests found
......@@ -57,3 +57,4 @@ add_subdirectory(extern/glow-extras)
add_subdirectory(rtglive0)
add_subdirectory(rtglive1)
add_subdirectory(rtglive2)
add_subdirectory(rtglive3)
# ===============================================
# Configure executable
file(GLOB_RECURSE SOURCES
"src/*.cc"
"src/*.hh"
"src/*.*sh"
"src/*.glsl"
)
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})
add_executable(rtglive3 ${SOURCES})
target_link_libraries(rtglive3 PUBLIC
glow
glow-extras
typed-geometry
ctracer
imgui
)
target_include_directories(rtglive3 PUBLIC "src")
# ===============================================
# Compile flags
if (MSVC)
target_compile_options(rtglive3 PUBLIC
/MP
)
else()
target_compile_options(rtglive3 PUBLIC
-Wall
-Wno-unused-variable
)
target_link_libraries(rtglive3 PUBLIC
-lstdc++fs
)
endif()
#include "LiveApp.hh"
#include <imgui/imgui.h>
#include <GLFW/glfw3.h>
#include <typed-geometry/tg.hh>
#include <glow/common/scoped_gl.hh>
void LiveApp::init()
{
setGui(Gui::ImGui);
GlfwApp::init();
}
void LiveApp::update(float elapsedSeconds)
{
// TODO
}
void LiveApp::render(float elapsedSeconds)
{
auto const w = getWindowWidth();
auto const h = getWindowHeight();
// clear screen
GLOW_SCOPED(clearColor, tg::color3::black);
glViewport(0, 0, w, h);
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
// TODO
}
void LiveApp::onGui()
{
// TODO
}
bool LiveApp::onKey(int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_A && action == GLFW_PRESS)
mKeyDownA = true;
if (key == GLFW_KEY_A && action == GLFW_RELEASE)
mKeyDownA = false;
if (key == GLFW_KEY_W && action == GLFW_PRESS)
mKeyDownW = true;
if (key == GLFW_KEY_W && action == GLFW_RELEASE)
mKeyDownW = false;
if (key == GLFW_KEY_D && action == GLFW_PRESS)
mKeyDownD = true;
if (key == GLFW_KEY_D && action == GLFW_RELEASE)
mKeyDownD = false;
if (key == GLFW_KEY_S && action == GLFW_PRESS)
mKeyDownS = true;
if (key == GLFW_KEY_S && action == GLFW_RELEASE)
mKeyDownS = false;
if (key == GLFW_KEY_SPACE && action == GLFW_PRESS)
mKeyDownSpace = true;
if (key == GLFW_KEY_SPACE && action == GLFW_RELEASE)
mKeyDownSpace = false;
return false;
}
#pragma once
#include <glow-extras/glfw/GlfwApp.hh>
#include <typed-geometry/tg-lean.hh>
class LiveApp : public glow::glfw::GlfwApp
{
bool mKeyDownW = false;
bool mKeyDownA = false;
bool mKeyDownS = false;
bool mKeyDownD = false;
bool mKeyDownSpace = false;
public:
void init() override;
void update(float elapsedSeconds) override;
void render(float elapsedSeconds) override;
void onGui() override;
bool onKey(int key, int scancode, int action, int mods) override;
};
#include "LiveApp.hh"
int main()
{
LiveApp app;
app.run();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment