Initial late commit
This commit is contained in:
286
application/include/.nvim_session
Normal file
286
application/include/.nvim_session
Normal file
@@ -0,0 +1,286 @@
|
||||
let SessionLoad = 1
|
||||
let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1
|
||||
let v:this_session=expand("<sfile>:p")
|
||||
silent only
|
||||
silent tabonly
|
||||
cd ~/projects/open_engine
|
||||
if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
|
||||
let s:wipebuf = bufnr('%')
|
||||
endif
|
||||
let s:shortmess_save = &shortmess
|
||||
if &shortmess =~ 'A'
|
||||
set shortmess=aoOA
|
||||
else
|
||||
set shortmess=aoO
|
||||
endif
|
||||
badd +1 ~/projects/open_engine
|
||||
badd +4 ~/projects/open_engine/.clangd
|
||||
badd +4 ~/projects/open_engine/open_engine/src/open_engine/opengl/opengl_shader.cpp
|
||||
badd +212 ~/projects/open_engine/application/include/sandbox.hpp
|
||||
badd +67 ~/projects/open_engine/open_engine/src/open_engine/renderer/shader.cpp
|
||||
badd +45 ~/projects/open_engine/open_engine/include/open_engine/opengl/opengl_shader.hpp
|
||||
badd +23 ~/projects/open_engine/open_engine/include/open_engine/input/linux_input.hpp
|
||||
badd +105 ~/projects/open_engine/open_engine/src/open_engine/input/linux_input.cpp
|
||||
badd +31 ~/projects/open_engine/open_engine/include/open_engine/input/input_system.hpp
|
||||
badd +1 ~/projects/open_engine/open_engine/include/open_engine.hpp
|
||||
badd +29 ~/projects/open_engine/open_engine/include/open_engine/renderer/shader.hpp
|
||||
badd +3392 ~/projects/open_engine/open_engine/vendor/glad/include/glad/glad.h
|
||||
badd +3 ~/projects/open_engine/assets/shaders/texture.glsl
|
||||
badd +39 ~/projects/open_engine/open_engine/include/open_engine/logging.hpp
|
||||
badd +1 ~/projects/open_engine/open_engine/src/open_engine/application.cpp
|
||||
badd +1 ~/projects/open_engine/open_engine/include/open_engine/pch.hpp
|
||||
badd +35 /usr/include/alloca.h
|
||||
badd +1 ~/projects/open_engine/DAP\ Watches
|
||||
badd +1 ~/projects/open_engine/DAP\ Stacks
|
||||
badd +1 ~/projects/open_engine/DAP\ Breakpoints
|
||||
badd +1 ~/projects/open_engine/DAP\ Scopes
|
||||
badd +1 ~/projects/open_engine/DAP\ Console
|
||||
badd +1 ~/projects/open_engine/\[dap-repl-27]
|
||||
badd +1529 /usr/include/c++/15.2.1/bits/shared_ptr_base.h
|
||||
badd +40 ~/projects/open_engine/open_engine/CMakeLists.txt
|
||||
badd +1 ~/projects/open_engine/.envrc
|
||||
badd +1 ~/projects/open_engine/.project_config
|
||||
badd +17 ~/projects/open_engine/imgui.ini
|
||||
badd +1 ~/projects/open_engine/compile_commands.json
|
||||
badd +28 ~/projects/open_engine/open_engine/include/open_engine/core.hpp
|
||||
badd +96 ~/projects/open_engine/open_engine/src/open_engine/window/linux_window.cpp
|
||||
badd +36 ~/projects/open_engine/open_engine/include/open_engine/window/window.hpp
|
||||
badd +609 /usr/include/GLFW/glfw3.h
|
||||
badd +650 ~/.conan2/p/b/imguic69fe98538919/p/include/imgui.h
|
||||
argglobal
|
||||
%argdel
|
||||
$argadd ~/projects/open_engine
|
||||
set stal=2
|
||||
tabnew +setlocal\ bufhidden=wipe
|
||||
tabnew +setlocal\ bufhidden=wipe
|
||||
tabnew +setlocal\ bufhidden=wipe
|
||||
tabrewind
|
||||
edit ~/projects/open_engine/open_engine/include/open_engine/input/input_system.hpp
|
||||
let s:save_splitbelow = &splitbelow
|
||||
let s:save_splitright = &splitright
|
||||
set splitbelow splitright
|
||||
wincmd _ | wincmd |
|
||||
vsplit
|
||||
1wincmd h
|
||||
wincmd w
|
||||
wincmd _ | wincmd |
|
||||
split
|
||||
1wincmd k
|
||||
wincmd w
|
||||
let &splitbelow = s:save_splitbelow
|
||||
let &splitright = s:save_splitright
|
||||
wincmd t
|
||||
let s:save_winminheight = &winminheight
|
||||
let s:save_winminwidth = &winminwidth
|
||||
set winminheight=0
|
||||
set winheight=1
|
||||
set winminwidth=0
|
||||
set winwidth=1
|
||||
exe 'vert 1resize ' . ((&columns * 124 + 127) / 255)
|
||||
exe '2resize ' . ((&lines * 29 + 31) / 62)
|
||||
exe 'vert 2resize ' . ((&columns * 2 + 127) / 255)
|
||||
exe '3resize ' . ((&lines * 29 + 31) / 62)
|
||||
exe 'vert 3resize ' . ((&columns * 2 + 127) / 255)
|
||||
argglobal
|
||||
balt ~/projects/open_engine/open_engine/src/open_engine/input/linux_input.cpp
|
||||
setlocal foldmethod=manual
|
||||
setlocal foldexpr=0
|
||||
setlocal foldmarker={{{,}}}
|
||||
setlocal foldignore=#
|
||||
setlocal foldlevel=0
|
||||
setlocal foldminlines=1
|
||||
setlocal foldnestmax=20
|
||||
setlocal foldenable
|
||||
silent! normal! zE
|
||||
let &fdl = &fdl
|
||||
let s:l = 28 - ((27 * winheight(0) + 29) / 59)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 28
|
||||
normal! 062|
|
||||
lcd ~/projects/open_engine
|
||||
wincmd w
|
||||
argglobal
|
||||
if bufexists(fnamemodify("~/projects/open_engine/open_engine/src/open_engine/input/linux_input.cpp", ":p")) | buffer ~/projects/open_engine/open_engine/src/open_engine/input/linux_input.cpp | else | edit ~/projects/open_engine/open_engine/src/open_engine/input/linux_input.cpp | endif
|
||||
if &buftype ==# 'terminal'
|
||||
silent file ~/projects/open_engine/open_engine/src/open_engine/input/linux_input.cpp
|
||||
endif
|
||||
balt /usr/include/GLFW/glfw3.h
|
||||
setlocal foldmethod=manual
|
||||
setlocal foldexpr=0
|
||||
setlocal foldmarker={{{,}}}
|
||||
setlocal foldignore=#
|
||||
setlocal foldlevel=0
|
||||
setlocal foldminlines=1
|
||||
setlocal foldnestmax=20
|
||||
setlocal foldenable
|
||||
silent! normal! zE
|
||||
let &fdl = &fdl
|
||||
let s:l = 105 - ((27 * winheight(0) + 14) / 29)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 105
|
||||
normal! 05|
|
||||
lcd ~/projects/open_engine
|
||||
wincmd w
|
||||
argglobal
|
||||
if bufexists(fnamemodify("~/projects/open_engine/open_engine/include/open_engine/input/linux_input.hpp", ":p")) | buffer ~/projects/open_engine/open_engine/include/open_engine/input/linux_input.hpp | else | edit ~/projects/open_engine/open_engine/include/open_engine/input/linux_input.hpp | endif
|
||||
if &buftype ==# 'terminal'
|
||||
silent file ~/projects/open_engine/open_engine/include/open_engine/input/linux_input.hpp
|
||||
endif
|
||||
balt ~/projects/open_engine/open_engine/include/open_engine/input/input_system.hpp
|
||||
setlocal foldmethod=manual
|
||||
setlocal foldexpr=0
|
||||
setlocal foldmarker={{{,}}}
|
||||
setlocal foldignore=#
|
||||
setlocal foldlevel=0
|
||||
setlocal foldminlines=1
|
||||
setlocal foldnestmax=20
|
||||
setlocal foldenable
|
||||
silent! normal! zE
|
||||
let &fdl = &fdl
|
||||
let s:l = 23 - ((18 * winheight(0) + 14) / 29)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 23
|
||||
normal! 086|
|
||||
lcd ~/projects/open_engine
|
||||
wincmd w
|
||||
exe 'vert 1resize ' . ((&columns * 124 + 127) / 255)
|
||||
exe '2resize ' . ((&lines * 29 + 31) / 62)
|
||||
exe 'vert 2resize ' . ((&columns * 2 + 127) / 255)
|
||||
exe '3resize ' . ((&lines * 29 + 31) / 62)
|
||||
exe 'vert 3resize ' . ((&columns * 2 + 127) / 255)
|
||||
tabnext
|
||||
edit ~/projects/open_engine/open_engine/src/open_engine/application.cpp
|
||||
let s:save_splitbelow = &splitbelow
|
||||
let s:save_splitright = &splitright
|
||||
set splitbelow splitright
|
||||
wincmd _ | wincmd |
|
||||
vsplit
|
||||
1wincmd h
|
||||
wincmd w
|
||||
let &splitbelow = s:save_splitbelow
|
||||
let &splitright = s:save_splitright
|
||||
wincmd t
|
||||
let s:save_winminheight = &winminheight
|
||||
let s:save_winminwidth = &winminwidth
|
||||
set winminheight=0
|
||||
set winheight=1
|
||||
set winminwidth=0
|
||||
set winwidth=1
|
||||
exe 'vert 1resize ' . ((&columns * 126 + 127) / 255)
|
||||
exe 'vert 2resize ' . ((&columns * 0 + 127) / 255)
|
||||
argglobal
|
||||
balt ~/projects/open_engine/open_engine/src/open_engine/window/linux_window.cpp
|
||||
setlocal foldmethod=manual
|
||||
setlocal foldexpr=0
|
||||
setlocal foldmarker={{{,}}}
|
||||
setlocal foldignore=#
|
||||
setlocal foldlevel=0
|
||||
setlocal foldminlines=1
|
||||
setlocal foldnestmax=20
|
||||
setlocal foldenable
|
||||
silent! normal! zE
|
||||
let &fdl = &fdl
|
||||
let s:l = 49 - ((33 * winheight(0) + 29) / 59)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 49
|
||||
normal! 044|
|
||||
lcd ~/projects/open_engine
|
||||
wincmd w
|
||||
argglobal
|
||||
if bufexists(fnamemodify("~/projects/open_engine/open_engine/src/open_engine/window/linux_window.cpp", ":p")) | buffer ~/projects/open_engine/open_engine/src/open_engine/window/linux_window.cpp | else | edit ~/projects/open_engine/open_engine/src/open_engine/window/linux_window.cpp | endif
|
||||
if &buftype ==# 'terminal'
|
||||
silent file ~/projects/open_engine/open_engine/src/open_engine/window/linux_window.cpp
|
||||
endif
|
||||
balt ~/projects/open_engine/open_engine/src/open_engine/application.cpp
|
||||
setlocal foldmethod=manual
|
||||
setlocal foldexpr=0
|
||||
setlocal foldmarker={{{,}}}
|
||||
setlocal foldignore=#
|
||||
setlocal foldlevel=0
|
||||
setlocal foldminlines=1
|
||||
setlocal foldnestmax=20
|
||||
setlocal foldenable
|
||||
silent! normal! zE
|
||||
let &fdl = &fdl
|
||||
let s:l = 97 - ((29 * winheight(0) + 29) / 59)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 97
|
||||
normal! 044|
|
||||
lcd ~/projects/open_engine
|
||||
wincmd w
|
||||
exe 'vert 1resize ' . ((&columns * 126 + 127) / 255)
|
||||
exe 'vert 2resize ' . ((&columns * 0 + 127) / 255)
|
||||
tabnext
|
||||
edit ~/projects/open_engine/application/include/sandbox.hpp
|
||||
wincmd t
|
||||
let s:save_winminheight = &winminheight
|
||||
let s:save_winminwidth = &winminwidth
|
||||
set winminheight=0
|
||||
set winheight=1
|
||||
set winminwidth=0
|
||||
set winwidth=1
|
||||
argglobal
|
||||
setlocal foldmethod=manual
|
||||
setlocal foldexpr=0
|
||||
setlocal foldmarker={{{,}}}
|
||||
setlocal foldignore=#
|
||||
setlocal foldlevel=0
|
||||
setlocal foldminlines=1
|
||||
setlocal foldnestmax=20
|
||||
setlocal foldenable
|
||||
silent! normal! zE
|
||||
let &fdl = &fdl
|
||||
let s:l = 212 - ((29 * winheight(0) + 29) / 59)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 212
|
||||
normal! 055|
|
||||
lcd ~/projects/open_engine/application/include
|
||||
tabnext
|
||||
edit ~/projects/open_engine/assets/shaders/texture.glsl
|
||||
argglobal
|
||||
setlocal foldmethod=manual
|
||||
setlocal foldexpr=0
|
||||
setlocal foldmarker={{{,}}}
|
||||
setlocal foldignore=#
|
||||
setlocal foldlevel=0
|
||||
setlocal foldminlines=1
|
||||
setlocal foldnestmax=20
|
||||
setlocal foldenable
|
||||
silent! normal! zE
|
||||
let &fdl = &fdl
|
||||
let s:l = 6 - ((5 * winheight(0) + 29) / 59)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 6
|
||||
normal! 0
|
||||
lcd ~/projects/open_engine
|
||||
tabnext 3
|
||||
set stal=1
|
||||
if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
|
||||
silent exe 'bwipe ' . s:wipebuf
|
||||
endif
|
||||
unlet! s:wipebuf
|
||||
set winheight=1 winwidth=20
|
||||
let &shortmess = s:shortmess_save
|
||||
let s:sx = expand("<sfile>:p:r")."x.vim"
|
||||
if filereadable(s:sx)
|
||||
exe "source " . fnameescape(s:sx)
|
||||
endif
|
||||
let &g:so = s:so_save | let &g:siso = s:siso_save
|
||||
set hlsearch
|
||||
doautoall SessionLoadPost
|
||||
unlet SessionLoad
|
||||
" vim: set ft=vim :
|
||||
251
application/include/sandbox.hpp
Executable file
251
application/include/sandbox.hpp
Executable file
@@ -0,0 +1,251 @@
|
||||
#ifndef SANDBOX_HPP
|
||||
#define SANDBOX_HPP
|
||||
|
||||
#include <open_engine.hpp>
|
||||
|
||||
#include <glm/ext/matrix_transform.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
#include <glad/glad.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
class SandboxLayer : public OpenEngine::Layer
|
||||
{
|
||||
public:
|
||||
OpenEngine::Ref<OpenEngine::VertexArray> CreateSquare()
|
||||
{
|
||||
OpenEngine::Ref<OpenEngine::VertexArray> square_vertex_array(OpenEngine::VertexArray::Create());
|
||||
|
||||
float square_vertices[5 * 4] = {
|
||||
-0.5f, -0.5f, 0.0f, 0.0f, 0.0f,
|
||||
0.5f, -0.5f, 0.0f, 1.0f, 0.0f,
|
||||
0.5f, 0.5f, 0.0f, 1.0f, 1.0f,
|
||||
-0.5f, 0.5f, 0.0f, 0.0f, 1.0f,
|
||||
};
|
||||
|
||||
OpenEngine::Ref<OpenEngine::VertexBuffer> vertex_buffer;
|
||||
vertex_buffer.reset(OpenEngine::VertexBuffer::Create(square_vertices, sizeof(square_vertices)));
|
||||
|
||||
OpenEngine::BufferLayout layout = {
|
||||
{ OpenEngine::ShaderDataType::Float3, "a_Position" },
|
||||
{ OpenEngine::ShaderDataType::Float2, "a_TextCoord" }
|
||||
};
|
||||
|
||||
vertex_buffer->SetLayout(layout);
|
||||
square_vertex_array->AddVertexBuffer(vertex_buffer);
|
||||
|
||||
uint32_t indices[6] = { 0, 1, 2, 2, 3, 0 };
|
||||
OpenEngine::Ref<OpenEngine::IndexBuffer> index_buffer;
|
||||
index_buffer.reset(OpenEngine::IndexBuffer::Create(indices, sizeof(indices) / sizeof(uint32_t)));
|
||||
|
||||
square_vertex_array->SetIndexBuffer(index_buffer);
|
||||
|
||||
return square_vertex_array;
|
||||
}
|
||||
|
||||
SandboxLayer()
|
||||
: Layer("Sandbox")
|
||||
{
|
||||
//vertex_array.reset(OpenEngine::VertexArray::Create());
|
||||
square = CreateSquare();
|
||||
|
||||
//float vertices[3 * 7] = {
|
||||
// -0.5f, -0.5f, 0.0f, 0.8f, 0.2f, 0.8f, 1.0f,
|
||||
// 0.5f, -0.5f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
// 0.0f, 0.5f, 0.0f, 0.8f, 0.8f, 0.2f, 1.0f
|
||||
//};
|
||||
|
||||
//OpenEngine::Ref<OpenEngine::VertexBuffer> vertex_buffer;
|
||||
//vertex_buffer.reset(OpenEngine::VertexBuffer::Create(vertices, sizeof(vertices)));
|
||||
|
||||
//OpenEngine::BufferLayout layout = {
|
||||
// {OpenEngine::ShaderDataType::Float3, "a_Position"},
|
||||
// {OpenEngine::ShaderDataType::Float4, "a_Color"}
|
||||
//};
|
||||
|
||||
//vertex_buffer->SetLayout(layout);
|
||||
//vertex_array->AddVertexBuffer(vertex_buffer);
|
||||
|
||||
//uint32_t indices[3] = { 0, 1, 2 };
|
||||
//OpenEngine::Ref<OpenEngine::IndexBuffer> index_buffer;
|
||||
//index_buffer.reset(OpenEngine::IndexBuffer::Create(indices, sizeof(indices) / sizeof(uint32_t)));
|
||||
|
||||
//shader = OpenEngine::Shader::Create("./assets/shaders/texture.glsl");
|
||||
//vertex_array->SetIndexBuffer(index_buffer);
|
||||
|
||||
//texture_shader = OpenEngine::Shader::Create("./assets/shaders/texture.glsl");
|
||||
auto texture_shader = shader_library.Load("./assets/shaders/texture.glsl");
|
||||
texture = OpenEngine::Texture2D::Create("./assets/textures/container.jpg");
|
||||
face = OpenEngine::Texture2D::Create("./assets/textures/awesomeface.png");
|
||||
|
||||
std::dynamic_pointer_cast<OpenEngine::OpenGLShader>(texture_shader)->Bind();
|
||||
std::dynamic_pointer_cast<OpenEngine::OpenGLShader>(texture_shader)->SetInt("u_Texture", 0);
|
||||
|
||||
for (auto joystick : OpenEngine::Input::GetJoystickList())
|
||||
OE_TRACE("Joystick {}: {}", joystick.first, joystick.second);
|
||||
|
||||
bindings = {
|
||||
{"fwd/bckwd", 1},
|
||||
{"right/left", 0},
|
||||
{"yaw", 2}
|
||||
};
|
||||
}
|
||||
|
||||
void moveCamera()
|
||||
{
|
||||
if (current_joystick != -1) {
|
||||
float raw_axis = OpenEngine::Input::GetJoystickAxis(current_joystick, bindings["yaw"]);
|
||||
float rotation = remap(raw_axis, -1, 1, -180, 180);
|
||||
camera.GetCamera().SetRotation(rotation);
|
||||
}
|
||||
}
|
||||
|
||||
void moveSquare(glm::vec3& position)
|
||||
{
|
||||
float velocity = 1 * OpenEngine::Time::Get().DeltaTime();
|
||||
if (OpenEngine::Input::IsKeyPressed(OE_KEY_I))
|
||||
position.y += velocity;
|
||||
if (OpenEngine::Input::IsKeyPressed(OE_KEY_Y))
|
||||
position.x -= velocity;
|
||||
if (OpenEngine::Input::IsKeyPressed(OE_KEY_U))
|
||||
position.y -= velocity;
|
||||
if (OpenEngine::Input::IsKeyPressed(OE_KEY_O))
|
||||
position.x += velocity;
|
||||
}
|
||||
|
||||
void moveSquareF(glm::vec3& position)
|
||||
{
|
||||
if (current_joystick != -1) {
|
||||
float test = OpenEngine::Input::GetJoystickAxis(current_joystick, bindings["fwd/bckwd"]);
|
||||
position.y = test;
|
||||
float test2 = OpenEngine::Input::GetJoystickAxis(current_joystick, bindings["right/left"]);
|
||||
position.x = test2;
|
||||
}
|
||||
}
|
||||
|
||||
float remap(float value, float minInput, float maxInput, float minOutput, float maxOutput) {
|
||||
// 1. Normalize the input to a 0.0 - 1.0 range
|
||||
float t = (value - minInput) / (maxInput - minInput);
|
||||
|
||||
// 2. Use glm::mix to interpolate between the output range
|
||||
return glm::mix(minOutput, maxOutput, t);
|
||||
}
|
||||
|
||||
void OnUpdate() override
|
||||
{
|
||||
static glm::mat4 scale = glm::scale(glm::mat4(1.0f), glm::vec3(1.0f));
|
||||
|
||||
OpenEngine::RenderCommand::SetClearColor({1.0f, 0.0f, 1.0f, 1.0f});
|
||||
OpenEngine::RenderCommand::Clear();
|
||||
|
||||
OpenEngine::Renderer::BeginScene(camera.GetCamera());
|
||||
|
||||
//shader->Bind();
|
||||
//vertex_array->Bind();
|
||||
|
||||
moveCamera();
|
||||
|
||||
//glm::mat4 transform = glm::translate(glm::mat4(1.0f), triangle_position);
|
||||
//OpenEngine::Renderer::Submit(shader, vertex_array, transform);
|
||||
|
||||
auto texture_shader = shader_library.Get("texture");
|
||||
|
||||
texture_shader->Bind();
|
||||
texture->Bind();
|
||||
glm::mat4 square_transform = glm::translate(glm::mat4(1.0f), square_pos) * scale;
|
||||
OpenEngine::Renderer::Submit(texture_shader, square, square_transform);
|
||||
moveSquare(square_pos);
|
||||
moveSquareF(square_pos);
|
||||
|
||||
face->Bind();
|
||||
OpenEngine::Renderer::Submit(texture_shader, square, square_transform);
|
||||
|
||||
OpenEngine::Renderer::EndScene();
|
||||
|
||||
//if (OpenEngine::Input::IsKeyPressed(OE_KEY_ESCAPE))
|
||||
// OpenEngine::Application::Get().StopRunning();
|
||||
camera.OnUpdate();
|
||||
}
|
||||
|
||||
void OnEvent(OpenEngine::Event& event) override
|
||||
{
|
||||
OpenEngine::EventDispatcher dispatcher(event);
|
||||
dispatcher.Dispatch<OpenEngine::KeyPressedEvent>(BIND_EVENT_FN(SandboxLayer::QuitRunning));
|
||||
|
||||
camera.OnEvent(event);
|
||||
}
|
||||
|
||||
bool QuitRunning(OpenEngine::KeyPressedEvent& event)
|
||||
{
|
||||
if (event.GetKeyCode() == OE_KEY_ESCAPE) {
|
||||
OpenEngine::Application::Get().StopRunning();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void OnImGuiRender() override
|
||||
{
|
||||
static std::vector<std::string> axis_labels;
|
||||
static std::vector<const char*> axis_pointers;
|
||||
|
||||
if (axis_labels.empty()) {
|
||||
axis_labels.reserve(MAX_AXIS);
|
||||
axis_pointers.reserve(MAX_AXIS);
|
||||
|
||||
for (int i = 0; i < MAX_AXIS; ++i) {
|
||||
axis_labels.push_back("Axis " + std::to_string(i + 1));
|
||||
axis_pointers.push_back(axis_labels.back().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
auto joysticks = OpenEngine::Input::GetJoystickList();
|
||||
ImGui::Begin("Settings");
|
||||
ImGui::ColorEdit3("Square Color", glm::value_ptr(square_color));
|
||||
ImGui::TextColored(ImVec4(1,1,0,1), "Important Stuff");
|
||||
ImGui::BeginChild("Child");
|
||||
ImGui::Text("-1");
|
||||
ImGui::RadioButton("None", ¤t_joystick, -1);
|
||||
for (const auto& joystick : joysticks) {
|
||||
ImGui::PushID(joystick.first);
|
||||
ImGui::Text("%d", joystick.first);
|
||||
ImGui::RadioButton(joystick.second.c_str(), ¤t_joystick, joystick.first);
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::Text("Bindings");
|
||||
for (auto& binding : bindings)
|
||||
ImGui::Combo(binding.first.c_str(), (int*)&binding.second, axis_pointers.data(), (int)axis_pointers.size());
|
||||
ImGui::EndChild();
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
OpenEngine::ShaderLibrary shader_library;
|
||||
//OpenEngine::Ref<OpenEngine::Shader> shader;
|
||||
//OpenEngine::OrthographicCamera camera = {-1.6f, 1.6f, -0.9f, 0.9f};
|
||||
OpenEngine::OrthographicCameraController camera = {1280.0f / 1440.0f, 1.0f};
|
||||
//OpenEngine::Ref<OpenEngine::VertexArray> vertex_array;
|
||||
OpenEngine::Ref<OpenEngine::VertexArray> square;
|
||||
|
||||
glm::vec3 triangle_position{0.0f};
|
||||
glm::vec3 square_pos{0.0f};
|
||||
glm::vec3 square_color{0.0f};
|
||||
|
||||
OpenEngine::Ref<OpenEngine::Texture2D> texture, face;
|
||||
//OpenEngine::Ref<OpenEngine::Shader> texture_shader;
|
||||
int current_joystick = -1;
|
||||
std::unordered_map<std::string, unsigned int> bindings;
|
||||
};
|
||||
|
||||
class Sandbox : public OpenEngine::Application
|
||||
{
|
||||
public:
|
||||
Sandbox();
|
||||
~Sandbox();
|
||||
};
|
||||
|
||||
#endif // SANDBOX_HPP
|
||||
Reference in New Issue
Block a user