Initial late commit
This commit is contained in:
23
open_engine/include/open_engine.hpp
Normal file
23
open_engine/include/open_engine.hpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef OPEN_ENGINE_HPP
|
||||
#define OPEN_ENGINE_HPP
|
||||
|
||||
#include "open_engine/application.hpp"
|
||||
#include "open_engine/logging.hpp"
|
||||
#include "open_engine/events/key_event.hpp"
|
||||
#include "open_engine/imgui/imgui_layer.hpp"
|
||||
#include "open_engine/renderer/render_command.hpp"
|
||||
#include "open_engine/renderer/renderer.hpp"
|
||||
#include "open_engine/core/time.hpp"
|
||||
#include "open_engine/input/input_system.hpp"
|
||||
#include "open_engine/input/keycodes.hpp"
|
||||
#include "open_engine/renderer/buffer.hpp"
|
||||
#include "open_engine/renderer/shader.hpp"
|
||||
#include "open_engine/opengl/opengl_shader.hpp"
|
||||
#include "open_engine/renderer/texture.hpp"
|
||||
#include "open_engine/orthographic_camera_controller.hpp"
|
||||
|
||||
// Entry Point -------------------------
|
||||
#include "open_engine/entry_point.hpp"
|
||||
// -------------------------------------
|
||||
|
||||
#endif // OPEN_ENGINE_HPP
|
||||
121
open_engine/include/open_engine/.nvim_session
Normal file
121
open_engine/include/open_engine/.nvim_session
Normal file
@@ -0,0 +1,121 @@
|
||||
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/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/open_engine
|
||||
badd +13 ~/projects/open_engine/open_engine/include/open_engine/orthographic_camera.hpp
|
||||
badd +24 ~/projects/open_engine/open_engine/src/open_engine/orthographic_camera.cpp
|
||||
badd +25 ~/projects/open_engine/open_engine/include/open_engine/application.hpp
|
||||
badd +18 ~/projects/open_engine/open_engine/src/open_engine/application.cpp
|
||||
badd +9 ~/projects/open_engine/open_engine/src/open_engine/renderer/renderer.cpp
|
||||
badd +1654 ~/projects/open_engine/open_engine/src/open_engine/opengl/imgui_glfw.cpp
|
||||
badd +8 ~/projects/open_engine/open_engine/src/open_engine/time.cpp
|
||||
badd +11 ~/projects/open_engine/open_engine/include/open_engine.hpp
|
||||
badd +22 ~/projects/open_engine/open_engine/include/open_engine/time.hpp
|
||||
badd +4 ~/projects/open_engine/open_engine/include/open_engine/input/input_system.hpp
|
||||
badd +1 ~/projects/open_engine/open_engine/include/open_engine/core.hpp
|
||||
badd +10 ~/projects/open_engine/open_engine/include/open_engine/renderer/shader.hpp
|
||||
badd +8 ~/projects/open_engine/open_engine/include/open_engine/opengl/opengl_shader.hpp
|
||||
badd +211 ~/projects/open_engine/open_engine/src/open_engine/imgui/imgui_layer.cpp
|
||||
badd +34 ~/projects/open_engine/open_engine/src/open_engine/window/linux_window.cpp
|
||||
badd +17 ~/projects/open_engine/open_engine/include/open_engine/window/linux_window.hpp
|
||||
badd +12 ~/projects/open_engine/open_engine/include/open_engine/entry_point.hpp
|
||||
badd +17 ~/projects/open_engine/open_engine/include/open_engine/window/window.hpp
|
||||
badd +1 ~/projects/open_engine/open_engine/justfile
|
||||
argglobal
|
||||
%argdel
|
||||
$argadd ~/projects/open_engine/open_engine
|
||||
edit ~/projects/open_engine/open_engine/include/open_engine.hpp
|
||||
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 * 104 + 62) / 125)
|
||||
exe 'vert 2resize ' . ((&columns * 20 + 62) / 125)
|
||||
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 = 11 - ((10 * winheight(0) + 29) / 59)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 11
|
||||
normal! 032|
|
||||
lcd ~/projects/open_engine/open_engine
|
||||
wincmd w
|
||||
argglobal
|
||||
if bufexists(fnamemodify("~/projects/open_engine/open_engine/include/open_engine/orthographic_camera.hpp", ":p")) | buffer ~/projects/open_engine/open_engine/include/open_engine/orthographic_camera.hpp | else | edit ~/projects/open_engine/open_engine/include/open_engine/orthographic_camera.hpp | endif
|
||||
if &buftype ==# 'terminal'
|
||||
silent file ~/projects/open_engine/open_engine/include/open_engine/orthographic_camera.hpp
|
||||
endif
|
||||
balt ~/projects/open_engine/open_engine/src/open_engine/orthographic_camera.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 = 12 - ((11 * winheight(0) + 29) / 59)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 12
|
||||
normal! 0
|
||||
lcd ~/projects/open_engine/open_engine
|
||||
wincmd w
|
||||
2wincmd w
|
||||
exe 'vert 1resize ' . ((&columns * 104 + 62) / 125)
|
||||
exe 'vert 2resize ' . ((&columns * 20 + 62) / 125)
|
||||
tabnext 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 &winminheight = s:save_winminheight
|
||||
let &winminwidth = s:save_winminwidth
|
||||
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 :
|
||||
49
open_engine/include/open_engine/application.hpp
Normal file
49
open_engine/include/open_engine/application.hpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef APPLICATION_HPP
|
||||
#define APPLICATION_HPP
|
||||
|
||||
#include "core.hpp"
|
||||
|
||||
#include "events/application_event.hpp"
|
||||
#include "imgui/imgui_layer.hpp"
|
||||
#include "layer.hpp"
|
||||
#include "layer_stack.hpp"
|
||||
#include "window/window.hpp"
|
||||
#include <memory>
|
||||
|
||||
namespace OpenEngine {
|
||||
class OE_API Application
|
||||
{
|
||||
public:
|
||||
Application();
|
||||
virtual ~Application() = default;
|
||||
|
||||
void Run();
|
||||
|
||||
virtual void OnEvent(Event& event);
|
||||
|
||||
void PushLayer(Layer* layer);
|
||||
void PushOverlay(Layer* overlay);
|
||||
|
||||
inline static Application& Get() { return *instance; }
|
||||
|
||||
inline Window& GetWindow() { return *window; }
|
||||
inline void StopRunning() { running = false; }
|
||||
|
||||
private:
|
||||
bool OnWindowClose(WindowCloseEvent& event);
|
||||
bool OnWindowResize(WindowResizeEvent& event);
|
||||
|
||||
inline static Application* instance;
|
||||
|
||||
bool running = true;
|
||||
std::unique_ptr<Window> window;
|
||||
|
||||
ImGuiLayer* imgui_layer;
|
||||
LayerStack layer_stack;
|
||||
};
|
||||
|
||||
// Is defined by client
|
||||
Application* CreateApplication();
|
||||
}
|
||||
|
||||
#endif // APPLICATION_HPP
|
||||
36
open_engine/include/open_engine/core.hpp
Normal file
36
open_engine/include/open_engine/core.hpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef CORE_HPP
|
||||
#define CORE_HPP
|
||||
|
||||
#include <memory>
|
||||
#ifdef __linux__
|
||||
#ifdef OE_EXPORT
|
||||
#define OE_API __attribute__((visibility("default")))
|
||||
#else
|
||||
#define OE_API
|
||||
#endif
|
||||
#elif defined(_WIN32) || defined(WIN32)
|
||||
#error Windows is not yet supported
|
||||
#endif
|
||||
|
||||
#ifdef OE_ENABLE_ASSERTS
|
||||
#include <signal.h>
|
||||
#define OE_ASSERT(x, ...) { if (!(x)) { OE_ERROR("Assertion Failed: {0}", __VA_ARGS__); raise(SIGTRAP); } }
|
||||
#define OE_CORE_ASSERT(x, ...) { if (!(x)) { OE_CORE_ERROR("Assertion Failed: {0}", __VA_ARGS__); raise(SIGTRAP); } }
|
||||
#else
|
||||
#define OE_ASSERT(x, ...)
|
||||
#define OE_CORE_ASSERT(x, ...)
|
||||
#endif
|
||||
|
||||
#define BIT(x) (1 << x)
|
||||
|
||||
#define BIND_EVENT_FN(function) std::bind(&function, this, std::placeholders::_1)
|
||||
|
||||
namespace OpenEngine {
|
||||
template<typename T>
|
||||
using Scope = std::unique_ptr<T>;
|
||||
|
||||
template<typename T>
|
||||
using Ref = std::shared_ptr<T>;
|
||||
}
|
||||
|
||||
#endif // CORE_HPP
|
||||
34
open_engine/include/open_engine/core/time.hpp
Normal file
34
open_engine/include/open_engine/core/time.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef TIME_HPP
|
||||
#define TIME_HPP
|
||||
|
||||
#include <chrono>
|
||||
|
||||
namespace OpenEngine {
|
||||
class Time
|
||||
{
|
||||
public:
|
||||
Time(const Time&) = delete; // No copy constructor
|
||||
Time& operator=(const Time&) = delete;
|
||||
|
||||
void Update();
|
||||
|
||||
static Time& Get()
|
||||
{
|
||||
if (instance == nullptr)
|
||||
instance.reset(new Time);
|
||||
|
||||
return *instance;
|
||||
}
|
||||
|
||||
double DeltaTime() const { return delta_time.count(); };
|
||||
|
||||
private:
|
||||
Time() {};
|
||||
std::chrono::high_resolution_clock::time_point previous_frame;
|
||||
static std::unique_ptr<Time> instance;
|
||||
std::chrono::duration<double> delta_time;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TIME_HPP
|
||||
17
open_engine/include/open_engine/entry_point.hpp
Normal file
17
open_engine/include/open_engine/entry_point.hpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef ENTRY_POINT_HPP
|
||||
#define ENTRY_POINT_HPP
|
||||
|
||||
#include "application.hpp"
|
||||
|
||||
extern OpenEngine::Application* OpenEngine::CreateApplication();
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
OpenEngine::Logger::Init();
|
||||
|
||||
auto app = OpenEngine::CreateApplication();
|
||||
app->Run();
|
||||
delete app;
|
||||
}
|
||||
|
||||
#endif // ENTRY_POINT_HPP
|
||||
53
open_engine/include/open_engine/events/application_event.hpp
Executable file
53
open_engine/include/open_engine/events/application_event.hpp
Executable file
@@ -0,0 +1,53 @@
|
||||
#ifndef APPLICATION_EVENT_HPP
|
||||
#define APPLICATION_EVENT_HPP
|
||||
|
||||
#include "event.hpp"
|
||||
|
||||
namespace OpenEngine {
|
||||
class OE_API WindowResizeEvent
|
||||
: public Event
|
||||
{
|
||||
public:
|
||||
WindowResizeEvent(unsigned int width, unsigned int height)
|
||||
: width(width), height(height)
|
||||
{
|
||||
}
|
||||
|
||||
inline unsigned int GetWidth() const { return width; }
|
||||
inline unsigned int GetHeight() const { return height; }
|
||||
|
||||
std::string ToString() const override;
|
||||
|
||||
EVENT_CLASS_TYPE(WindowResized)
|
||||
EVENT_CLASS_CATEGORY(EventCategoryApplication)
|
||||
|
||||
private:
|
||||
unsigned int width, height;
|
||||
};
|
||||
|
||||
class OE_API WindowCloseEvent
|
||||
: public Event
|
||||
{
|
||||
public:
|
||||
WindowCloseEvent() {}
|
||||
|
||||
std::string ToString() const override;
|
||||
|
||||
EVENT_CLASS_TYPE(WindowClose)
|
||||
EVENT_CLASS_CATEGORY(EventCategoryApplication)
|
||||
};
|
||||
|
||||
class OE_API AppUpdateEvent
|
||||
: public Event
|
||||
{
|
||||
public:
|
||||
AppUpdateEvent() {}
|
||||
|
||||
std::string ToString() const override;
|
||||
|
||||
EVENT_CLASS_TYPE(AppUpdate)
|
||||
EVENT_CLASS_CATEGORY(EventCategoryApplication)
|
||||
};
|
||||
}
|
||||
|
||||
#endif // APPLICATION_EVENT_HPP
|
||||
78
open_engine/include/open_engine/events/event.hpp
Normal file
78
open_engine/include/open_engine/events/event.hpp
Normal file
@@ -0,0 +1,78 @@
|
||||
#ifndef EVENT_HPP
|
||||
#define EVENT_HPP
|
||||
|
||||
#include "../core.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace OpenEngine {
|
||||
enum class EventType
|
||||
{
|
||||
none = 0,
|
||||
WindowClose, WindowResized, WindowFocus, WindowLostFocus, WindowMoved,
|
||||
AppUpdate,
|
||||
KeyPressed, KeyReleased, KeyTyped,
|
||||
MouseButtonPressed, MouseButtonReleased, MouseMoved, MouseScrolled
|
||||
};
|
||||
|
||||
enum EventCategory
|
||||
{
|
||||
None = 0,
|
||||
EventCategoryApplication = BIT(0),
|
||||
EventCategoryInput = BIT(1),
|
||||
EventCategoryKeyboard = BIT(2),
|
||||
EventCategoryMouse = BIT(3),
|
||||
EventCategoryMouseButton = BIT(4)
|
||||
};
|
||||
|
||||
#define EVENT_CLASS_TYPE(type) static EventType GetStaticType() { return EventType::type; }\
|
||||
virtual EventType GetEventType() const override { return GetStaticType(); }\
|
||||
virtual const char* GetName() const override { return #type; }
|
||||
|
||||
#define EVENT_CLASS_CATEGORY(category) virtual int GetCategoryFlags() const override { return category; }
|
||||
|
||||
class OE_API Event
|
||||
{
|
||||
public:
|
||||
virtual EventType GetEventType() const = 0;
|
||||
virtual const char* GetName() const = 0;
|
||||
virtual int GetCategoryFlags() const = 0;
|
||||
virtual std::string ToString() const { return GetName(); }
|
||||
|
||||
inline bool IsInCategory(EventCategory category) {
|
||||
return GetCategoryFlags() & category;
|
||||
}
|
||||
|
||||
bool handled = false;
|
||||
};
|
||||
|
||||
class EventDispatcher
|
||||
{
|
||||
public:
|
||||
EventDispatcher(Event& event)
|
||||
: event(event)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T, typename F>
|
||||
bool Dispatch(const F& func)
|
||||
{
|
||||
if (event.GetEventType() == T::GetStaticType())
|
||||
{
|
||||
event.handled = func(static_cast<T&>(event));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
Event& event;
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& os, const Event& e)
|
||||
{
|
||||
return os << e.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // EVENT_HPP
|
||||
76
open_engine/include/open_engine/events/key_event.hpp
Normal file
76
open_engine/include/open_engine/events/key_event.hpp
Normal file
@@ -0,0 +1,76 @@
|
||||
#ifndef KEY_EVENT_HPP
|
||||
#define KEY_EVENT_HPP
|
||||
|
||||
#include "event.hpp"
|
||||
|
||||
namespace OpenEngine {
|
||||
class OE_API KeyEvent
|
||||
: public Event
|
||||
{
|
||||
public:
|
||||
inline int GetKeyCode() const { return keycode; }
|
||||
inline int GetScanCode() const { return scancode; }
|
||||
inline int GetMods() const { return mods; }
|
||||
|
||||
EVENT_CLASS_CATEGORY(EventCategoryInput | EventCategoryKeyboard)
|
||||
|
||||
protected:
|
||||
KeyEvent(int keycode, int scancode, int mods)
|
||||
: keycode(keycode), scancode(scancode), mods(mods)
|
||||
{
|
||||
}
|
||||
|
||||
int keycode;
|
||||
int scancode;
|
||||
int mods;
|
||||
};
|
||||
|
||||
class OE_API KeyPressedEvent
|
||||
: public KeyEvent
|
||||
{
|
||||
public:
|
||||
KeyPressedEvent(int keycode, int scancode, int repeat_count, int mods)
|
||||
: KeyEvent(keycode, scancode, mods), repeat_count(repeat_count)
|
||||
{
|
||||
}
|
||||
|
||||
inline int GetRepeatCount() { return repeat_count; };
|
||||
|
||||
std::string ToString() const override;
|
||||
|
||||
EVENT_CLASS_TYPE(KeyPressed)
|
||||
|
||||
private:
|
||||
int repeat_count;
|
||||
};
|
||||
|
||||
class OE_API KeyReleasedEvent
|
||||
: public KeyEvent
|
||||
{
|
||||
public:
|
||||
KeyReleasedEvent(int keycode, int scancode, int mods)
|
||||
: KeyEvent(keycode, scancode, mods)
|
||||
{
|
||||
}
|
||||
|
||||
std::string ToString() const override;
|
||||
|
||||
EVENT_CLASS_TYPE(KeyReleased)
|
||||
};
|
||||
|
||||
class OE_API KeyTypedEvent
|
||||
: public KeyEvent
|
||||
{
|
||||
public:
|
||||
KeyTypedEvent(int keycode)
|
||||
: KeyEvent(keycode, 0, 0)
|
||||
{
|
||||
}
|
||||
|
||||
std::string ToString() const override;
|
||||
|
||||
EVENT_CLASS_TYPE(KeyTyped)
|
||||
};
|
||||
}
|
||||
|
||||
#endif // KEY_EVENT_HPP
|
||||
93
open_engine/include/open_engine/events/mouse_event.hpp
Executable file
93
open_engine/include/open_engine/events/mouse_event.hpp
Executable file
@@ -0,0 +1,93 @@
|
||||
#ifndef MOUSE_EVENT_HPP
|
||||
#define MOUSE_EVENT_HPP
|
||||
|
||||
#include "event.hpp"
|
||||
|
||||
namespace OpenEngine {
|
||||
class OE_API MouseMovedEvent
|
||||
: public Event
|
||||
{
|
||||
public:
|
||||
MouseMovedEvent(float mouse_x, float mouse_y)
|
||||
: mouse_x(mouse_x), mouse_y(mouse_y)
|
||||
{
|
||||
}
|
||||
|
||||
inline float GetX() const { return mouse_x; };
|
||||
inline float GetY() const { return mouse_y; };
|
||||
|
||||
std::string ToString() const override;
|
||||
|
||||
EVENT_CLASS_TYPE(MouseMoved)
|
||||
EVENT_CLASS_CATEGORY(EventCategoryMouse | EventCategoryInput)
|
||||
|
||||
private:
|
||||
float mouse_x, mouse_y;
|
||||
};
|
||||
|
||||
class OE_API MouseScrolledEvent
|
||||
: public Event
|
||||
{
|
||||
public:
|
||||
MouseScrolledEvent(float x_offset, float y_offset)
|
||||
: x_offset(x_offset), y_offset(y_offset)
|
||||
{
|
||||
}
|
||||
|
||||
inline float GetXOffset() const { return x_offset; }
|
||||
inline float GetYOffset() const { return y_offset; }
|
||||
|
||||
std::string ToString() const override;
|
||||
|
||||
EVENT_CLASS_TYPE(MouseScrolled)
|
||||
EVENT_CLASS_CATEGORY(EventCategoryMouse | EventCategoryInput)
|
||||
|
||||
private:
|
||||
float x_offset, y_offset;
|
||||
};
|
||||
|
||||
class OE_API MouseButtonEvent
|
||||
: public Event
|
||||
{
|
||||
public:
|
||||
inline int GetMouseButton() const { return button; }
|
||||
|
||||
EVENT_CLASS_CATEGORY(EventCategoryMouse | EventCategoryInput)
|
||||
|
||||
protected:
|
||||
MouseButtonEvent(int button)
|
||||
: button(button)
|
||||
{
|
||||
}
|
||||
|
||||
int button;
|
||||
};
|
||||
|
||||
class OE_API MouseButtonPressedEvent
|
||||
: public MouseButtonEvent
|
||||
{
|
||||
public:
|
||||
MouseButtonPressedEvent(int button)
|
||||
: MouseButtonEvent(button)
|
||||
{
|
||||
}
|
||||
|
||||
std::string ToString() const override;
|
||||
|
||||
EVENT_CLASS_TYPE(MouseButtonPressed)
|
||||
};
|
||||
|
||||
class OE_API MouseButtonReleasedEvent
|
||||
: public MouseButtonEvent
|
||||
{
|
||||
public:
|
||||
MouseButtonReleasedEvent(int button)
|
||||
: MouseButtonEvent(button) {}
|
||||
|
||||
std::string ToString() const override;
|
||||
|
||||
EVENT_CLASS_TYPE(MouseButtonReleased)
|
||||
};
|
||||
}
|
||||
|
||||
#endif // MOUSE_EVENT_HPP
|
||||
26
open_engine/include/open_engine/imgui/imgui_layer.hpp
Normal file
26
open_engine/include/open_engine/imgui/imgui_layer.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef IMGUI_LAYER_HPP
|
||||
#define IMGUI_LAYER_HPP
|
||||
|
||||
#include "../core.hpp"
|
||||
#include "../layer.hpp"
|
||||
|
||||
namespace OpenEngine {
|
||||
class OE_API ImGuiLayer : public Layer
|
||||
{
|
||||
public:
|
||||
ImGuiLayer();
|
||||
~ImGuiLayer() = default;
|
||||
|
||||
virtual void OnAttach() override;
|
||||
virtual void OnDetach() override;
|
||||
virtual void OnImGuiRender() override;
|
||||
|
||||
void Begin();
|
||||
void End();
|
||||
|
||||
private:
|
||||
float previous_frame_time = 0.0f;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // IMGUI_LAYER_HPP
|
||||
61
open_engine/include/open_engine/input/input_system.hpp
Normal file
61
open_engine/include/open_engine/input/input_system.hpp
Normal file
@@ -0,0 +1,61 @@
|
||||
#ifndef INPUT_HPP
|
||||
#define INPUT_HPP
|
||||
|
||||
#include "../core.hpp"
|
||||
#include <map>
|
||||
|
||||
#define MAX_AXIS 10
|
||||
|
||||
namespace OpenEngine {
|
||||
class OE_API Input
|
||||
{
|
||||
public:
|
||||
Input(const Input&) = delete;
|
||||
Input& operator=(const Input&) = delete;
|
||||
|
||||
inline static bool IsKeyPressed(int keycode) { return instance->IsKeyPressedImpl(keycode); };
|
||||
|
||||
inline static bool IsMouseButtonPressed(int button) { return instance->IsMouseButtonPressedImpl(button); };
|
||||
|
||||
inline static std::pair<float, float> GetMousePosition() { return instance->GetMousePositionImpl(); };
|
||||
inline static bool GetMouseX() { return instance->GetMouseXImpl(); };
|
||||
inline static bool GetMouseY() { return instance->GetMouseYImpl(); };
|
||||
|
||||
inline static bool JoystickExists(unsigned int joystick) { return instance->JoystickExistsImpl(joystick); };
|
||||
inline static std::map<unsigned int, std::string> GetJoystickList() { return instance->GetJoystickListImpl(); };
|
||||
|
||||
inline static float GetJoystickAxis(unsigned int joystick, unsigned int axis) { return instance->GetJoystickAxisImpl(joystick, axis); };
|
||||
inline static const float* GetJoystickAxes(unsigned int joystick) { return instance->GetJoystickAxesImpl(joystick); };
|
||||
inline static unsigned int GetJoystickAxesCount(unsigned int joystick) { return instance->GetJoystickAxesCountImpl(joystick); };
|
||||
|
||||
inline static bool IsJoystickButtonPressed(unsigned int joystick, unsigned int button) { return instance->IsJoystickButtonPressedImpl(joystick, button); };
|
||||
|
||||
protected:
|
||||
Input() = default;
|
||||
|
||||
virtual bool IsKeyPressedImpl(int keycode) = 0;
|
||||
|
||||
virtual bool IsMouseButtonPressedImpl(int button) = 0;
|
||||
|
||||
virtual std::pair<float, float> GetMousePositionImpl() = 0;
|
||||
virtual float GetMouseXImpl() = 0;
|
||||
virtual float GetMouseYImpl() = 0;
|
||||
|
||||
virtual bool JoystickExistsImpl(unsigned int joystick) = 0;
|
||||
virtual std::map<unsigned int, std::string> GetJoystickListImpl() = 0;
|
||||
virtual const std::string GetJoystickNameImpl(unsigned int joystick) = 0;
|
||||
|
||||
virtual float GetJoystickAxisImpl(unsigned int joystick, unsigned int axis) = 0;
|
||||
virtual const float* GetJoystickAxesImpl(unsigned int joystick) = 0;
|
||||
virtual unsigned int GetJoystickAxesCountImpl(unsigned int joystick) = 0;
|
||||
|
||||
virtual bool IsJoystickButtonPressedImpl(unsigned int joystick, unsigned int button) = 0;
|
||||
|
||||
private:
|
||||
inline static const std::string GetJoystickName(unsigned int joystick) { return instance->GetJoystickNameImpl(joystick); };
|
||||
|
||||
static Input* instance;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // INPUT_HPP
|
||||
127
open_engine/include/open_engine/input/keycodes.hpp
Normal file
127
open_engine/include/open_engine/input/keycodes.hpp
Normal file
@@ -0,0 +1,127 @@
|
||||
#ifndef KEYCODES_HPP
|
||||
#define KEYCODES_HPP
|
||||
|
||||
#define OE_KEY_SPACE 32
|
||||
#define OE_KEY_APOSTROPHE 39 /* ' */
|
||||
#define OE_KEY_COMMA 44 /* , */
|
||||
#define OE_KEY_MINUS 45 /* - */
|
||||
#define OE_KEY_PERIOD 46 /* . */
|
||||
#define OE_KEY_SLASH 47 /* / */
|
||||
#define OE_KEY_0 48
|
||||
#define OE_KEY_1 49
|
||||
#define OE_KEY_2 50
|
||||
#define OE_KEY_3 51
|
||||
#define OE_KEY_4 52
|
||||
#define OE_KEY_5 53
|
||||
#define OE_KEY_6 54
|
||||
#define OE_KEY_7 55
|
||||
#define OE_KEY_8 56
|
||||
#define OE_KEY_9 57
|
||||
#define OE_KEY_SEMICOLON 59 /* ; */
|
||||
#define OE_KEY_EQUAL 61 /* = */
|
||||
#define OE_KEY_A 65
|
||||
#define OE_KEY_B 66
|
||||
#define OE_KEY_C 67
|
||||
#define OE_KEY_D 68
|
||||
#define OE_KEY_E 69
|
||||
#define OE_KEY_F 70
|
||||
#define OE_KEY_G 71
|
||||
#define OE_KEY_H 72
|
||||
#define OE_KEY_I 73
|
||||
#define OE_KEY_J 74
|
||||
#define OE_KEY_K 75
|
||||
#define OE_KEY_L 76
|
||||
#define OE_KEY_M 77
|
||||
#define OE_KEY_N 78
|
||||
#define OE_KEY_O 79
|
||||
#define OE_KEY_P 80
|
||||
#define OE_KEY_Q 81
|
||||
#define OE_KEY_R 82
|
||||
#define OE_KEY_S 83
|
||||
#define OE_KEY_T 84
|
||||
#define OE_KEY_U 85
|
||||
#define OE_KEY_V 86
|
||||
#define OE_KEY_W 87
|
||||
#define OE_KEY_X 88
|
||||
#define OE_KEY_Y 89
|
||||
#define OE_KEY_Z 90
|
||||
#define OE_KEY_LEFT_BRACKET 91 /* [ */
|
||||
#define OE_KEY_BACKSLASH 92 /* \ */
|
||||
#define OE_KEY_RIGHT_BRACKET 93 /* ] */
|
||||
#define OE_KEY_GRAVE_ACCENT 96 /* ` */
|
||||
#define OE_KEY_WORLD_1 161 /* non-US #1 */
|
||||
#define OE_KEY_WORLD_2 162 /* non-US #2 */
|
||||
|
||||
/* FunctOEn keys */
|
||||
#define OE_KEY_ESCAPE 256
|
||||
#define OE_KEY_ENTER 257
|
||||
#define OE_KEY_TAB 258
|
||||
#define OE_KEY_BACKSPACE 259
|
||||
#define OE_KEY_INSERT 260
|
||||
#define OE_KEY_DELETE 261
|
||||
#define OE_KEY_RIGHT 262
|
||||
#define OE_KEY_LEFT 263
|
||||
#define OE_KEY_DOWN 264
|
||||
#define OE_KEY_UP 265
|
||||
#define OE_KEY_PAGE_UP 266
|
||||
#define OE_KEY_PAGE_DOWN 267
|
||||
#define OE_KEY_HOME 268
|
||||
#define OE_KEY_END 269
|
||||
#define OE_KEY_CAPS_LOCK 280
|
||||
#define OE_KEY_SCROLL_LOCK 281
|
||||
#define OE_KEY_NUM_LOCK 282
|
||||
#define OE_KEY_PRINT_SCREEN 283
|
||||
#define OE_KEY_PAUSE 284
|
||||
#define OE_KEY_F1 290
|
||||
#define OE_KEY_F2 291
|
||||
#define OE_KEY_F3 292
|
||||
#define OE_KEY_F4 293
|
||||
#define OE_KEY_F5 294
|
||||
#define OE_KEY_F6 295
|
||||
#define OE_KEY_F7 296
|
||||
#define OE_KEY_F8 297
|
||||
#define OE_KEY_F9 298
|
||||
#define OE_KEY_F10 299
|
||||
#define OE_KEY_F11 300
|
||||
#define OE_KEY_F12 301
|
||||
#define OE_KEY_F13 302
|
||||
#define OE_KEY_F14 303
|
||||
#define OE_KEY_F15 304
|
||||
#define OE_KEY_F16 305
|
||||
#define OE_KEY_F17 306
|
||||
#define OE_KEY_F18 307
|
||||
#define OE_KEY_F19 308
|
||||
#define OE_KEY_F20 309
|
||||
#define OE_KEY_F21 310
|
||||
#define OE_KEY_F22 311
|
||||
#define OE_KEY_F23 312
|
||||
#define OE_KEY_F24 313
|
||||
#define OE_KEY_F25 314
|
||||
#define OE_KEY_KP_0 320
|
||||
#define OE_KEY_KP_1 321
|
||||
#define OE_KEY_KP_2 322
|
||||
#define OE_KEY_KP_3 323
|
||||
#define OE_KEY_KP_4 324
|
||||
#define OE_KEY_KP_5 325
|
||||
#define OE_KEY_KP_6 326
|
||||
#define OE_KEY_KP_7 327
|
||||
#define OE_KEY_KP_8 328
|
||||
#define OE_KEY_KP_9 329
|
||||
#define OE_KEY_KP_DECIMAL 330
|
||||
#define OE_KEY_KP_DIVIDE 331
|
||||
#define OE_KEY_KP_MULTIPLY 332
|
||||
#define OE_KEY_KP_SUBTRACT 333
|
||||
#define OE_KEY_KP_ADD 334
|
||||
#define OE_KEY_KP_ENTER 335
|
||||
#define OE_KEY_KP_EQUAL 336
|
||||
#define OE_KEY_LEFT_SHIFT 340
|
||||
#define OE_KEY_LEFT_CONTROL 341
|
||||
#define OE_KEY_LEFT_ALT 342
|
||||
#define OE_KEY_LEFT_SUPER 343
|
||||
#define OE_KEY_RIGHT_SHIFT 344
|
||||
#define OE_KEY_RIGHT_CONTROL 345
|
||||
#define OE_KEY_RIGHT_ALT 346
|
||||
#define OE_KEY_RIGHT_SUPER 347
|
||||
#define OE_KEY_MENU 348
|
||||
|
||||
#endif // KEYCODES_HPP
|
||||
33
open_engine/include/open_engine/input/linux_input.hpp
Normal file
33
open_engine/include/open_engine/input/linux_input.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef LINUX_INPUT_HPP
|
||||
#define LINUX_INPUT_HPP
|
||||
|
||||
#include "input_system.hpp"
|
||||
|
||||
namespace OpenEngine {
|
||||
class LinuxInput : public Input
|
||||
{
|
||||
protected:
|
||||
virtual bool IsKeyPressedImpl(int keycode) override;
|
||||
|
||||
virtual bool IsMouseButtonPressedImpl(int button) override;
|
||||
|
||||
virtual std::pair<float, float> GetMousePositionImpl() override;
|
||||
virtual float GetMouseXImpl() override;
|
||||
virtual float GetMouseYImpl() override;
|
||||
|
||||
virtual bool JoystickExistsImpl(unsigned int joystick) override;
|
||||
|
||||
virtual float GetJoystickAxisImpl(unsigned int joystick, unsigned int axis) override;
|
||||
virtual const std::string GetJoystickNameImpl(unsigned int joystick) override;
|
||||
|
||||
virtual std::map<unsigned int, std::string> GetJoystickListImpl() override;
|
||||
virtual const float* GetJoystickAxesImpl(unsigned int joystick) override;
|
||||
virtual unsigned int GetJoystickAxesCountImpl(unsigned int joystick) override;
|
||||
|
||||
virtual bool IsJoystickButtonPressedImpl(unsigned int joystick, unsigned int button) override;
|
||||
|
||||
private:
|
||||
};
|
||||
}
|
||||
|
||||
#endif // LINUX_INPUT_HPP
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef MOUSE_BUTTONS_CODES_HPP
|
||||
#define MOUSE_BUTTONS_CODES_HPP
|
||||
|
||||
#define HZ_MOUSE_BUTTON_1 0
|
||||
#define HZ_MOUSE_BUTTON_2 1
|
||||
#define HZ_MOUSE_BUTTON_3 2
|
||||
#define HZ_MOUSE_BUTTON_4 3
|
||||
#define HZ_MOUSE_BUTTON_5 4
|
||||
#define HZ_MOUSE_BUTTON_6 5
|
||||
#define HZ_MOUSE_BUTTON_7 6
|
||||
#define HZ_MOUSE_BUTTON_8 7
|
||||
#define HZ_MOUSE_BUTTON_LAST HZ_MOUSE_BUTTON_8
|
||||
#define HZ_MOUSE_BUTTON_LEFT HZ_MOUSE_BUTTON_1
|
||||
#define HZ_MOUSE_BUTTON_RIGHT HZ_MOUSE_BUTTON_2
|
||||
#define HZ_MOUSE_BUTTON_MIDDLE HZ_MOUSE_BUTTON_3
|
||||
|
||||
#endif // MOUSE_BUTTONS_CODES_HPP
|
||||
27
open_engine/include/open_engine/layer.hpp
Normal file
27
open_engine/include/open_engine/layer.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef LAYER_HPP
|
||||
#define LAYER_HPP
|
||||
|
||||
#include "events/event.hpp"
|
||||
#include "core.hpp"
|
||||
|
||||
namespace OpenEngine {
|
||||
class OE_API Layer
|
||||
{
|
||||
public:
|
||||
Layer(const std::string& name = "layer");
|
||||
virtual ~Layer() = default;
|
||||
|
||||
virtual void OnAttach() {}
|
||||
virtual void OnDetach() {}
|
||||
virtual void OnUpdate() {}
|
||||
virtual void OnImGuiRender() {}
|
||||
virtual void OnEvent(Event& event) {}
|
||||
|
||||
inline const std::string& GetName() const { return debug_name; }
|
||||
|
||||
protected:
|
||||
std::string debug_name = "";
|
||||
};
|
||||
}
|
||||
|
||||
#endif // LAYER_HPP
|
||||
29
open_engine/include/open_engine/layer_stack.hpp
Normal file
29
open_engine/include/open_engine/layer_stack.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef LAYER_STACK_HPP
|
||||
#define LAYER_STACK_HPP
|
||||
|
||||
#include "core.hpp"
|
||||
#include "layer.hpp"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace OpenEngine {
|
||||
class OE_API LayerStack
|
||||
{
|
||||
public:
|
||||
LayerStack();
|
||||
~LayerStack();
|
||||
|
||||
void PushLayer(Layer* layer);
|
||||
void PopLayer(Layer* layer);
|
||||
void PushOverlay(Layer* overlay);
|
||||
void PopOverlay(Layer* overlay);
|
||||
|
||||
std::vector<Layer*>::iterator begin() { return layers.begin(); }
|
||||
std::vector<Layer*>::iterator end() { return layers.end(); }
|
||||
private:
|
||||
std::vector<Layer*> layers;
|
||||
unsigned int layer_insert_index = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // LAYER_STACK_HPP
|
||||
43
open_engine/include/open_engine/logging.hpp
Normal file
43
open_engine/include/open_engine/logging.hpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef LOGGING_HPP
|
||||
#define LOGGING_HPP
|
||||
|
||||
#include "core.hpp"
|
||||
|
||||
#include <spdlog/logger.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace OE_API OpenEngine {
|
||||
spdlog::level::level_enum stringToLogLevel(std::string level_str);
|
||||
int setupMultisinkLogger(const std::string &file_path);
|
||||
|
||||
class Logger
|
||||
{
|
||||
public:
|
||||
static void Init();
|
||||
|
||||
inline static std::shared_ptr<spdlog::logger>& GetCoreLogger() { return core_logger; }
|
||||
inline static std::shared_ptr<spdlog::logger>& GetClientLogger() { return client_logger; }
|
||||
private:
|
||||
static std::shared_ptr<spdlog::logger> core_logger;
|
||||
static std::shared_ptr<spdlog::logger> client_logger;
|
||||
};
|
||||
}
|
||||
|
||||
#define OE_CORE_TRACE(...) ::OpenEngine::Logger::GetCoreLogger()->trace(__VA_ARGS__)
|
||||
#define OE_CORE_DEBUG(...) ::OpenEngine::Logger::GetCoreLogger()->debug(__VA_ARGS__)
|
||||
#define OE_CORE_INFO(...) ::OpenEngine::Logger::GetCoreLogger()->info(__VA_ARGS__)
|
||||
#define OE_CORE_WARN(...) ::OpenEngine::Logger::GetCoreLogger()->warn(__VA_ARGS__)
|
||||
#define OE_CORE_ERROR(...) ::OpenEngine::Logger::GetCoreLogger()->error(__VA_ARGS__)
|
||||
#define OE_CORE_CRITICAL(...) ::OpenEngine::Logger::GetCoreLogger()->critical(__VA_ARGS__)
|
||||
|
||||
#define OE_TRACE(...) ::OpenEngine::Logger::GetClientLogger()->trace(__VA_ARGS__)
|
||||
#define OE_DEBUG(...) ::OpenEngine::Logger::GetClientLogger()->debug(__VA_ARGS__)
|
||||
#define OE_INFO(...) ::OpenEngine::Logger::GetClientLogger()->info(__VA_ARGS__)
|
||||
#define OE_WARN(...) ::OpenEngine::Logger::GetClientLogger()->warn(__VA_ARGS__)
|
||||
#define OE_ERROR(...) ::OpenEngine::Logger::GetClientLogger()->error(__VA_ARGS__)
|
||||
#define OE_CRITICAL(...) ::OpenEngine::Logger::GetClientLogger()->critical(__VA_ARGS__)
|
||||
|
||||
#endif // LOGGING_HPP
|
||||
73
open_engine/include/open_engine/opengl/imgui_glfw.h
Normal file
73
open_engine/include/open_engine/opengl/imgui_glfw.h
Normal file
@@ -0,0 +1,73 @@
|
||||
// dear imgui: Platform Backend for GLFW
|
||||
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan, WebGPU..)
|
||||
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
||||
// (Requires: GLFW 3.0+. Prefer GLFW 3.3+/3.4+ for full feature support.)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Platform: Clipboard support.
|
||||
// [X] Platform: Mouse support. Can discriminate Mouse/TouchScreen/Pen (Windows only).
|
||||
// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy GLFW_KEY_* values are obsolete since 1.87 and not supported since 1.91.5]
|
||||
// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
||||
// [X] Platform: Mouse cursor shape and visibility (ImGuiBackendFlags_HasMouseCursors) with GLFW 3.1+. Resizing cursors requires GLFW 3.4+! Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
||||
// [X] Platform: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
||||
// [X] Multiple Dear ImGui contexts support.
|
||||
// Missing features or Issues:
|
||||
// [ ] Platform: Touch events are only correctly identified as Touch on Windows. This create issues with some interactions. GLFW doesn't provide a way to identify touch inputs from mouse inputs, we cannot call io.AddMouseSourceEvent() to identify the source. We provide a Windows-specific workaround.
|
||||
// [ ] Platform: Missing ImGuiMouseCursor_Wait and ImGuiMouseCursor_Progress cursors.
|
||||
// [ ] Platform: Multi-viewport: Missing ImGuiBackendFlags_HasParentViewport support. The viewport->ParentViewportID field is ignored, and therefore io.ConfigViewportsNoDefaultParent has no effect either.
|
||||
|
||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||
// Learn about Dear ImGui:
|
||||
// - FAQ https://dearimgui.com/faq
|
||||
// - Getting Started https://dearimgui.com/getting-started
|
||||
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
|
||||
// - Introduction, links and more at the top of imgui.cpp
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
#ifndef IMGUI_DISABLE
|
||||
|
||||
struct GLFWwindow;
|
||||
struct GLFWmonitor;
|
||||
|
||||
// Follow "Getting Started" link and check examples/ folder to learn about using backends!
|
||||
IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks);
|
||||
IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks);
|
||||
IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOther(GLFWwindow* window, bool install_callbacks);
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame();
|
||||
|
||||
// Emscripten related initialization phase methods (call after ImGui_ImplGlfw_InitForOpenGL)
|
||||
#ifdef __EMSCRIPTEN__
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_InstallEmscriptenCallbacks(GLFWwindow* window, const char* canvas_selector);
|
||||
//static inline void ImGui_ImplGlfw_InstallEmscriptenCanvasResizeCallback(const char* canvas_selector) { ImGui_ImplGlfw_InstallEmscriptenCallbacks(nullptr, canvas_selector); } } // Renamed in 1.91.0
|
||||
#endif
|
||||
|
||||
// GLFW callbacks install
|
||||
// - When calling Init with 'install_callbacks=true': ImGui_ImplGlfw_InstallCallbacks() is called. GLFW callbacks will be installed for you. They will chain-call user's previously installed callbacks, if any.
|
||||
// - When calling Init with 'install_callbacks=false': GLFW callbacks won't be installed. You will need to call individual function yourself from your own GLFW callbacks.
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_InstallCallbacks(GLFWwindow* window);
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_RestoreCallbacks(GLFWwindow* window);
|
||||
|
||||
// GFLW callbacks options:
|
||||
// - Set 'chain_for_all_windows=true' to enable chaining callbacks for all windows (including secondary viewports created by backends or by user)
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_SetCallbacksChainForAllWindows(bool chain_for_all_windows);
|
||||
|
||||
// GLFW callbacks (individual callbacks to call yourself if you didn't install callbacks)
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_WindowFocusCallback(GLFWwindow* window, int focused); // Since 1.84
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_CursorEnterCallback(GLFWwindow* window, int entered); // Since 1.84
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_CursorPosCallback(GLFWwindow* window, double x, double y); // Since 1.87
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods);
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset);
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c);
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_MonitorCallback(GLFWmonitor* monitor, int event);
|
||||
|
||||
// GLFW helpers
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_Sleep(int milliseconds);
|
||||
IMGUI_IMPL_API float ImGui_ImplGlfw_GetContentScaleForWindow(GLFWwindow* window);
|
||||
IMGUI_IMPL_API float ImGui_ImplGlfw_GetContentScaleForMonitor(GLFWmonitor* monitor);
|
||||
|
||||
|
||||
#endif // #ifndef IMGUI_DISABLE
|
||||
69
open_engine/include/open_engine/opengl/imgui_opengl.h
Normal file
69
open_engine/include/open_engine/opengl/imgui_opengl.h
Normal file
@@ -0,0 +1,69 @@
|
||||
// dear imgui: Renderer Backend for modern OpenGL with shaders / programmatic pipeline
|
||||
// - Desktop GL: 2.x 3.x 4.x
|
||||
// - Embedded GL: ES 2.0 (WebGL 1.0), ES 3.0 (WebGL 2.0)
|
||||
// This needs to be used along with a Platform Backend (e.g. GLFW, SDL, Win32, custom..)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture as texture identifier. Read the FAQ about ImTextureID/ImTextureRef!
|
||||
// [x] Renderer: Large meshes support (64k+ vertices) even with 16-bit indices (ImGuiBackendFlags_RendererHasVtxOffset) [Desktop OpenGL only!]
|
||||
// [X] Renderer: Texture updates support for dynamic font atlas (ImGuiBackendFlags_RendererHasTextures).
|
||||
// [X] Renderer: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
||||
|
||||
// About WebGL/ES:
|
||||
// - You need to '#define IMGUI_IMPL_OPENGL_ES2' or '#define IMGUI_IMPL_OPENGL_ES3' to use WebGL or OpenGL ES.
|
||||
// - This is done automatically on iOS, Android and Emscripten targets.
|
||||
// - For other targets, the define needs to be visible from the imgui_impl_opengl3.cpp compilation unit. If unsure, define globally or in imconfig.h.
|
||||
|
||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||
// Learn about Dear ImGui:
|
||||
// - FAQ https://dearimgui.com/faq
|
||||
// - Getting Started https://dearimgui.com/getting-started
|
||||
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
|
||||
// - Introduction, links and more at the top of imgui.cpp
|
||||
|
||||
// About GLSL version:
|
||||
// The 'glsl_version' initialization parameter should be nullptr (default) or a "#version XXX" string.
|
||||
// On computer platform the GLSL version default to "#version 130". On OpenGL ES 3 platform it defaults to "#version 300 es"
|
||||
// Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp.
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
#ifndef IMGUI_DISABLE
|
||||
|
||||
// Follow "Getting Started" link and check examples/ folder to learn about using backends!
|
||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = nullptr);
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame();
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data);
|
||||
|
||||
// (Optional) Called by Init/NewFrame/Shutdown
|
||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects();
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects();
|
||||
|
||||
// (Advanced) Use e.g. if you need to precisely control the timing of texture updates (e.g. for staged rendering), by setting ImDrawData::Textures = NULL to handle this manually.
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_UpdateTexture(ImTextureData* tex);
|
||||
|
||||
// Configuration flags to add in your imconfig file:
|
||||
//#define IMGUI_IMPL_OPENGL_ES2 // Enable ES 2 (Auto-detected on Emscripten)
|
||||
//#define IMGUI_IMPL_OPENGL_ES3 // Enable ES 3 (Auto-detected on iOS/Android)
|
||||
|
||||
// You can explicitly select GLES2 or GLES3 API by using one of the '#define IMGUI_IMPL_OPENGL_LOADER_XXX' in imconfig.h or compiler command-line.
|
||||
#if !defined(IMGUI_IMPL_OPENGL_ES2) \
|
||||
&& !defined(IMGUI_IMPL_OPENGL_ES3)
|
||||
|
||||
// Try to detect GLES on matching platforms
|
||||
#if defined(__APPLE__)
|
||||
#include <TargetConditionals.h>
|
||||
#endif
|
||||
#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) || (defined(__ANDROID__))
|
||||
#define IMGUI_IMPL_OPENGL_ES3 // iOS, Android -> GL ES 3, "#version 300 es"
|
||||
#elif defined(__EMSCRIPTEN__) || defined(__amigaos4__)
|
||||
#define IMGUI_IMPL_OPENGL_ES2 // Emscripten -> GL ES 2, "#version 100"
|
||||
#else
|
||||
// Otherwise imgui_impl_opengl3_loader.h will be used.
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif // #ifndef IMGUI_DISABLE
|
||||
41
open_engine/include/open_engine/opengl/opengl_buffer.hpp
Normal file
41
open_engine/include/open_engine/opengl/opengl_buffer.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef OPENGL_BUFFER_HPP
|
||||
#define OPENGL_BUFFER_HPP
|
||||
|
||||
#include "renderer/buffer.hpp"
|
||||
#include <cstdint>
|
||||
namespace OpenEngine {
|
||||
class OpenGLVertexBuffer : public VertexBuffer
|
||||
{
|
||||
public:
|
||||
OpenGLVertexBuffer(float* vertices, uint32_t size);
|
||||
virtual ~OpenGLVertexBuffer();
|
||||
|
||||
virtual void Bind() const override;
|
||||
virtual void UnBind() const override;
|
||||
|
||||
virtual const BufferLayout& GetLayout() const override { return layout; }
|
||||
virtual void SetLayout(const BufferLayout& layout) override { this->layout = layout; }
|
||||
|
||||
private:
|
||||
BufferLayout layout;
|
||||
unsigned int id;
|
||||
};
|
||||
|
||||
class OpenGLIndexBuffer : public IndexBuffer
|
||||
{
|
||||
public:
|
||||
OpenGLIndexBuffer(uint32_t* indices, uint32_t count);
|
||||
virtual ~OpenGLIndexBuffer();
|
||||
|
||||
virtual void Bind() const override;
|
||||
virtual void UnBind() const override;
|
||||
|
||||
virtual uint32_t GetCount() const override { return count; };
|
||||
|
||||
private:
|
||||
unsigned int id;
|
||||
uint32_t count;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // OPENGL_BUFFER_HPP
|
||||
22
open_engine/include/open_engine/opengl/opengl_context.hpp
Normal file
22
open_engine/include/open_engine/opengl/opengl_context.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef OPENGL_CONTEXT_HPP
|
||||
#define OPENGL_CONTEXT_HPP
|
||||
|
||||
#include "renderer/graphics_context.hpp"
|
||||
|
||||
struct GLFWwindow;
|
||||
|
||||
namespace OpenEngine {
|
||||
class OpenGLContext : public GraphicsContext
|
||||
{
|
||||
public:
|
||||
OpenGLContext(GLFWwindow* window_handle);
|
||||
|
||||
virtual void Init() override;
|
||||
virtual void SwapBuffers() override;
|
||||
|
||||
private:
|
||||
GLFWwindow* window_handle;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // OPENGL_CONTEXT_HPP
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef OPENGL_RENDERER_API_HPP
|
||||
#define OPENGL_RENDERER_API_HPP
|
||||
|
||||
#include "../renderer/renderer_api.hpp"
|
||||
|
||||
namespace OpenEngine {
|
||||
class OpenGLRendererAPI : public RendererAPI
|
||||
{
|
||||
public:
|
||||
virtual void Init() override;
|
||||
|
||||
virtual void SetViewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height) override;
|
||||
|
||||
virtual void SetClearColor(const glm::vec4& color) override;
|
||||
virtual void Clear() override;
|
||||
|
||||
virtual void DrawIndexed(const std::shared_ptr<VertexArray>& vertex_array) override;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // OPENGL_RENDEREAPI_HPP
|
||||
45
open_engine/include/open_engine/opengl/opengl_shader.hpp
Executable file
45
open_engine/include/open_engine/opengl/opengl_shader.hpp
Executable file
@@ -0,0 +1,45 @@
|
||||
#ifndef OPENGL_SHADER_HPP
|
||||
#define OPENGL_SHADER_HPP
|
||||
|
||||
#include "../renderer/shader.hpp"
|
||||
#include <sys/types.h>
|
||||
#include <string>
|
||||
#include <glad/glad.h>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace OpenEngine {
|
||||
class OpenGLShader : public Shader
|
||||
{
|
||||
public:
|
||||
OpenGLShader(const std::string& shader_path);
|
||||
OpenGLShader(const std::string& name, const std::string& vertex_src, const std::string& frament_src);
|
||||
virtual ~OpenGLShader() = default;
|
||||
|
||||
virtual const std::string& GetName() const override { return name; };
|
||||
|
||||
// activate the shader
|
||||
virtual void Bind() const override;
|
||||
virtual void Unbind() const override;
|
||||
|
||||
// utility uniform functions
|
||||
virtual void SetBool(const std::string &name, bool value) const;
|
||||
virtual void SetInt(const std::string &name, int value) const;
|
||||
virtual void SetFloat(const std::string &name, float value) const;
|
||||
virtual void SetMat4(const std::string &name, const glm::mat4& value) const;
|
||||
virtual void SetVec3(const std::string &name, const glm::vec3& value) const;
|
||||
|
||||
|
||||
private:
|
||||
std::string ReadFile(const std::string& shader_path);
|
||||
std::unordered_map<GLenum, std::string> PreProcess(const std::string& shader_source);
|
||||
void Compile(const std::unordered_map<GLenum, std::string> sources);
|
||||
|
||||
void CheckCompileErrors(unsigned int shader, const std::string& type);
|
||||
|
||||
std::string name;
|
||||
|
||||
u_int32_t id;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // OPENGL_SHADER_HPP
|
||||
27
open_engine/include/open_engine/opengl/opengl_texture.hpp
Normal file
27
open_engine/include/open_engine/opengl/opengl_texture.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef OPENGL_TEXTURE_HPP
|
||||
#define OPENGL_TEXTURE_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include <renderer/texture.hpp>
|
||||
|
||||
namespace OpenEngine {
|
||||
class OpenGLTexture2D : public Texture2D
|
||||
{
|
||||
public:
|
||||
OpenGLTexture2D(const std::string& path);
|
||||
virtual ~OpenGLTexture2D();
|
||||
|
||||
virtual uint32_t GetWidth() const override { return width; };
|
||||
virtual uint32_t GetHeight() const override { return height; };
|
||||
|
||||
virtual void Bind(uint32_t slot = 0) const override;
|
||||
|
||||
private:
|
||||
std::string path;
|
||||
|
||||
uint32_t width, height;
|
||||
uint32_t id;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // OPENGL_TEXTURE_HPP
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef OPENGL_VERTEX_ARRAY_HPP
|
||||
#define OPENGL_VERTEX_ARRAY_HPP
|
||||
|
||||
#include "renderer/vertex_array.hpp"
|
||||
|
||||
namespace OpenEngine {
|
||||
class OpenGLVertexArray : public VertexArray
|
||||
{
|
||||
public:
|
||||
OpenGLVertexArray();
|
||||
~OpenGLVertexArray();
|
||||
|
||||
virtual void Bind() const override;
|
||||
virtual void UnBind() const override;
|
||||
|
||||
virtual void AddVertexBuffer(const std::shared_ptr<VertexBuffer>& vertex_buffer) override;
|
||||
virtual void SetIndexBuffer(const std::shared_ptr<IndexBuffer>& index_buffer) override;
|
||||
|
||||
virtual const std::vector<std::shared_ptr<VertexBuffer>>& GetVertexBuffers() const override { return vertex_buffers; }
|
||||
virtual const std::shared_ptr<IndexBuffer>& GetIndexBuffer() const override { return index_buffer; }
|
||||
|
||||
private:
|
||||
uint32_t id;
|
||||
uint32_t index = 0;
|
||||
std::vector<std::shared_ptr<VertexBuffer>> vertex_buffers;
|
||||
std::shared_ptr<IndexBuffer> index_buffer;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // OPENGL_VERTEX_ARRAY_HPP
|
||||
36
open_engine/include/open_engine/orthographic_camera.hpp
Normal file
36
open_engine/include/open_engine/orthographic_camera.hpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef CAMERA_HPP
|
||||
#define CAMERA_HPP
|
||||
|
||||
#include <glm/fwd.hpp>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
namespace OpenEngine {
|
||||
class OrthographicCamera
|
||||
{
|
||||
public:
|
||||
OrthographicCamera(float left, float right, float bottom, float top);
|
||||
void SetProjection(float left, float right, float bottom, float top);
|
||||
|
||||
const glm::vec3& GetPosition() const { return position; };
|
||||
void SetPosition(const glm::vec3& position) { this->position = position; RecalculateViewMatrix(); };
|
||||
|
||||
const float& GetRotation() const { return rotation; };
|
||||
void SetRotation(float rotation) { this->rotation = rotation; RecalculateViewMatrix(); };
|
||||
|
||||
const glm::mat4& GetProjectionMatrix() const { return projection_matrix; };
|
||||
const glm::mat4& GetViewMatrix() const { return view_matrix; };
|
||||
const glm::mat4& GetViewProjectionMatrix() const { return view_projection_matrix; };
|
||||
|
||||
private:
|
||||
void RecalculateViewMatrix();
|
||||
|
||||
glm::mat4 projection_matrix;
|
||||
glm::mat4 view_matrix;
|
||||
glm::mat4 view_projection_matrix;
|
||||
|
||||
glm::vec3 position{0.0f};
|
||||
float rotation = 0.0f;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // CAMERA_HPP
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef ORTHOGRAPHIC_CAMERA_CONTROLLER_HPP
|
||||
#define ORTHOGRAPHIC_CAMERA_CONTROLLER_HPP
|
||||
|
||||
#include "open_engine/events/application_event.hpp"
|
||||
#include "open_engine/events/mouse_event.hpp"
|
||||
#include "open_engine/events/event.hpp"
|
||||
#include "open_engine/orthographic_camera.hpp"
|
||||
|
||||
#include <glm/fwd.hpp>
|
||||
|
||||
namespace OpenEngine {
|
||||
class OrthographicCameraController
|
||||
{
|
||||
public:
|
||||
OrthographicCameraController(float ratio, float zoom);
|
||||
|
||||
void OnUpdate();
|
||||
void OnEvent(Event& e);
|
||||
|
||||
const OrthographicCamera& GetCamera() const { return camera; };
|
||||
OrthographicCamera GetCamera() { return camera;};
|
||||
|
||||
float GetZoom() const { return zoom; }
|
||||
void SetZoom(float level) { zoom = level; };
|
||||
|
||||
private:
|
||||
bool OnMouseScrolled(MouseScrolledEvent& e);
|
||||
bool OnWindowResized(WindowResizeEvent& e);
|
||||
|
||||
void Translate(const glm::vec3& vector);
|
||||
void Rotate(float speed);
|
||||
|
||||
private:
|
||||
float aspect_ratio;
|
||||
float zoom = 1.0f;
|
||||
OrthographicCamera camera;
|
||||
|
||||
bool rotation;
|
||||
|
||||
glm::vec3 camera_position = {0.0f, 0.0f, 0.0f};
|
||||
float camera_rotation = 0.0f;
|
||||
float translation_speed = 5.0f, rotation_speed = 180.0f;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // ORTHOGRAPHIC_CAMERA_CONTROLLER_HPP
|
||||
13
open_engine/include/open_engine/pch.hpp
Normal file
13
open_engine/include/open_engine/pch.hpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef PCH_HPP
|
||||
#define PCH_HPP
|
||||
|
||||
#include "logging.hpp"
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <memory>
|
||||
#include <array>
|
||||
|
||||
#endif // PCH_HPP
|
||||
220
open_engine/include/open_engine/renderer/.nvim_session
Normal file
220
open_engine/include/open_engine/renderer/.nvim_session
Normal file
@@ -0,0 +1,220 @@
|
||||
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/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/open_engine
|
||||
badd +170 ~/projects/open_engine/open_engine/src/open_engine/imgui/imgui_layer.cpp
|
||||
badd +4 ~/projects/open_engine/open_engine/include/open_engine/opengl/imgui_glfw.h
|
||||
badd +35 ~/projects/open_engine/open_engine/include/open_engine/opengl/imgui_opengl.h
|
||||
badd +23 ~/projects/open_engine/open_engine/src/open_engine/application.cpp
|
||||
badd +47 ~/projects/open_engine/open_engine/CMakeLists.txt
|
||||
badd +12 ~/projects/open_engine/open_engine/include/open_engine/imgui/imgui_layer.hpp
|
||||
badd +123 ~/projects/open_engine/open_engine/src/open_engine/opengl/imgui_opengl.cpp
|
||||
badd +89 ~/.conan2/p/b/imgui15e51a8fb5246/p/include/imgui.h
|
||||
badd +7 ~/projects/open_engine/open_engine/.envrc
|
||||
badd +5 ~/projects/open_engine/open_engine/include/open_engine/core.hpp
|
||||
badd +11 ~/.conan2/p/b/imgui15e51a8fb5246/p/include/imgui_export_headers.h
|
||||
badd +1 ~/projects/open_engine/open_engine/src/open_engine/opengl/build_opengl.cpp
|
||||
badd +4 ~/projects/open_engine/open_engine/src/open_engine/opengl/imgui_build.cpp
|
||||
badd +1 ~/projects/open_engine/open_engine/conanfile.txt
|
||||
badd +1 ~/projects/open_engine/open_engine/build/imguiTargets.cmake
|
||||
badd +8 ~/projects/open_engine/open_engine/include/open_engine/logging.hpp
|
||||
badd +4 ~/projects/open_engine/open_engine/src/open_engine/logging.cpp
|
||||
badd +110 ~/projects/open_engine/open_engine/src/open_engine/opengl/imgui_glfw.cpp
|
||||
badd +1 ~/projects/open_engine/open_engine/include/open_engine/application.hpp
|
||||
badd +21 ~/projects/open_engine/open_engine/src/open_engine/window/linux_window.cpp
|
||||
badd +24 ~/projects/open_engine/open_engine/include/open_engine/window/window.hpp
|
||||
badd +27 ~/projects/open_engine/open_engine/include/open_engine/window/linux_window.hpp
|
||||
badd +7 ~/projects/open_engine/open_engine/include/open_engine/renderer/GraphicsContext.hpp
|
||||
badd +12 ~/projects/open_engine/open_engine/include/open_engine/opengl/opengl_context.hpp
|
||||
badd +10 ~/projects/open_engine/open_engine/src/open_engine/input/linux_input.cpp
|
||||
badd +17 ~/projects/open_engine/open_engine/src/open_engine/opengl/opengl_context.cpp
|
||||
badd +3295 ~/projects/open_engine/open_engine/vendor/glad/include/glad/glad.h
|
||||
badd +148 ~/projects/open_engine/open_engine/vendor/glad/src/glad/glad.c
|
||||
badd +13 ~/projects/open_engine/open_engine/include/open_engine/renderer/graphics_context.hpp
|
||||
badd +80 ~/projects/open_engine/open_engine/src/open_engine/opengl/opengl_shader.cpp
|
||||
badd +8 ~/projects/open_engine/open_engine/include/open_engine/opengl/opengl_shader.hpp
|
||||
badd +8 ~/projects/open_engine/open_engine/include/open_engine/renderer/shader.hpp
|
||||
badd +1 ~/projects/open_engine/open_engine/src/open_engine/renderer/shader.cpp
|
||||
badd +1 ~/projects/open_engine/open_engine/include/open_engine/pch.hpp
|
||||
badd +3 ~/projects/open_engine/open_engine/assets/shaders/fragment.frag.old
|
||||
badd +1 ~/projects/open_engine/open_engine/assets/shaders/fragment.frag
|
||||
badd +5 ~/projects/open_engine/open_engine/assets/shaders/vertex.vert
|
||||
badd +1 ~/projects/open_engine/open_engine/\'
|
||||
badd +66 ~/projects/open_engine/open_engine/include/open_engine/renderer/buffer.hpp
|
||||
badd +56 ~/projects/open_engine/open_engine/src/open_engine/renderer/buffer.cpp
|
||||
badd +18 ~/projects/open_engine/open_engine/include/open_engine/opengl/opengl_buffer.hpp
|
||||
badd +34 ~/projects/open_engine/open_engine/src/open_engine/opengl/opengl_buffer.cpp
|
||||
badd +2 ~/projects/open_engine/open_engine/src/open_engine/renderer/renderer.cpp
|
||||
badd +5 ~/projects/open_engine/open_engine/include/open_engine/renderer/renderer.hpp
|
||||
badd +1 ~/projects/open_engine/open_engine/src/open_engine/layer.cpp
|
||||
badd +12 ~/projects/open_engine/open_engine/include/open_engine/layer.hpp
|
||||
badd +21 ~/projects/open_engine/open_engine/include/open_engine/events/event.hpp
|
||||
badd +11 ~/projects/open_engine/open_engine/src/open_engine/renderer/vertex_array.cpp
|
||||
badd +8 ~/projects/open_engine/open_engine/include/open_engine/renderer/vertex_array.hpp
|
||||
badd +27 ~/projects/open_engine/open_engine/src/open_engine/layer_stack.cpp
|
||||
badd +1 ~/projects/open_engine/open_engine/include/open_engine/layer_stack.hpp
|
||||
argglobal
|
||||
%argdel
|
||||
$argadd ~/projects/open_engine/open_engine
|
||||
set stal=2
|
||||
tabnew +setlocal\ bufhidden=wipe
|
||||
tabrewind
|
||||
edit ~/projects/open_engine/open_engine/include/open_engine/renderer/vertex_array.hpp
|
||||
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 * 127 + 127) / 255)
|
||||
exe 'vert 2resize ' . ((&columns * 127 + 127) / 255)
|
||||
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 = 8 - ((7 * winheight(0) + 13) / 27)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 8
|
||||
normal! 0
|
||||
lcd ~/projects/open_engine/open_engine
|
||||
wincmd w
|
||||
argglobal
|
||||
if bufexists(fnamemodify("~/projects/open_engine/open_engine/include/open_engine/renderer/vertex_array.hpp", ":p")) | buffer ~/projects/open_engine/open_engine/include/open_engine/renderer/vertex_array.hpp | else | edit ~/projects/open_engine/open_engine/include/open_engine/renderer/vertex_array.hpp | endif
|
||||
if &buftype ==# 'terminal'
|
||||
silent file ~/projects/open_engine/open_engine/include/open_engine/renderer/vertex_array.hpp
|
||||
endif
|
||||
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 = 1 - ((0 * winheight(0) + 13) / 27)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 1
|
||||
normal! 0
|
||||
lcd ~/projects/open_engine/open_engine
|
||||
wincmd w
|
||||
exe 'vert 1resize ' . ((&columns * 127 + 127) / 255)
|
||||
exe 'vert 2resize ' . ((&columns * 127 + 127) / 255)
|
||||
tabnext
|
||||
edit ~/projects/open_engine/open_engine/assets/shaders/fragment.frag
|
||||
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 * 254 + 127) / 255)
|
||||
exe 'vert 2resize ' . ((&columns * 0 + 127) / 255)
|
||||
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 = 11 - ((8 * winheight(0) + 13) / 27)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 11
|
||||
normal! 020|
|
||||
lcd ~/projects/open_engine/open_engine
|
||||
wincmd w
|
||||
argglobal
|
||||
if bufexists(fnamemodify("~/projects/open_engine/open_engine/assets/shaders/vertex.vert", ":p")) | buffer ~/projects/open_engine/open_engine/assets/shaders/vertex.vert | else | edit ~/projects/open_engine/open_engine/assets/shaders/vertex.vert | endif
|
||||
if &buftype ==# 'terminal'
|
||||
silent file ~/projects/open_engine/open_engine/assets/shaders/vertex.vert
|
||||
endif
|
||||
balt ~/projects/open_engine/open_engine/assets/shaders/fragment.frag
|
||||
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 = 12 - ((11 * winheight(0) + 13) / 27)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 12
|
||||
normal! 022|
|
||||
lcd ~/projects/open_engine/open_engine
|
||||
wincmd w
|
||||
exe 'vert 1resize ' . ((&columns * 254 + 127) / 255)
|
||||
exe 'vert 2resize ' . ((&columns * 0 + 127) / 255)
|
||||
tabnext 1
|
||||
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 &winminheight = s:save_winminheight
|
||||
let &winminwidth = s:save_winminwidth
|
||||
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 :
|
||||
87
open_engine/include/open_engine/renderer/buffer.hpp
Normal file
87
open_engine/include/open_engine/renderer/buffer.hpp
Normal file
@@ -0,0 +1,87 @@
|
||||
#ifndef BUFFER_HPP
|
||||
#define BUFFER_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace OpenEngine {
|
||||
|
||||
enum class ShaderDataType
|
||||
{
|
||||
Float = 0, Float2, Float3, Float4, Mat3, Mat4, Int, Int2, Int3, Int4, Bool
|
||||
};
|
||||
|
||||
uint32_t shaderDataTypeSize(ShaderDataType type);
|
||||
|
||||
struct BufferLayoutElement
|
||||
{
|
||||
std::string name;
|
||||
ShaderDataType type;
|
||||
uint32_t size;
|
||||
uint32_t offset;
|
||||
bool normalized;
|
||||
|
||||
BufferLayoutElement() {};
|
||||
BufferLayoutElement(ShaderDataType type, const std::string& name, bool normalized = false)
|
||||
: name(name), type(type), size(shaderDataTypeSize(type)), offset(0), normalized(normalized)
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t GetComponentCount() const;
|
||||
};
|
||||
|
||||
class BufferLayout
|
||||
{
|
||||
public:
|
||||
BufferLayout() {};
|
||||
BufferLayout(const std::initializer_list<BufferLayoutElement>& elements)
|
||||
: elements(elements)
|
||||
{
|
||||
CalculateOffsetsAndStride();
|
||||
}
|
||||
|
||||
inline uint32_t GetStride() const { return stride; }
|
||||
inline const std::vector<BufferLayoutElement>& GetElements() const { return elements; }
|
||||
|
||||
std::vector<BufferLayoutElement>::iterator begin() { return elements.begin(); }
|
||||
std::vector<BufferLayoutElement>::iterator end() { return elements.end(); }
|
||||
std::vector<BufferLayoutElement>::const_iterator begin() const { return elements.begin(); }
|
||||
std::vector<BufferLayoutElement>::const_iterator end() const { return elements.end(); }
|
||||
|
||||
private:
|
||||
void CalculateOffsetsAndStride();
|
||||
|
||||
std::vector<BufferLayoutElement> elements;
|
||||
uint32_t stride = 0;
|
||||
};
|
||||
|
||||
class VertexBuffer
|
||||
{
|
||||
public:
|
||||
virtual ~VertexBuffer() = default;
|
||||
|
||||
virtual void Bind() const = 0;
|
||||
virtual void UnBind() const = 0;
|
||||
|
||||
virtual const BufferLayout& GetLayout() const = 0;
|
||||
virtual void SetLayout(const BufferLayout& layout) = 0;
|
||||
|
||||
static VertexBuffer* Create(float* vertices, uint32_t size);
|
||||
};
|
||||
|
||||
class IndexBuffer
|
||||
{
|
||||
public:
|
||||
virtual ~IndexBuffer() = default;
|
||||
|
||||
virtual void Bind() const = 0;
|
||||
virtual void UnBind() const = 0;
|
||||
|
||||
virtual uint32_t GetCount() const = 0;
|
||||
|
||||
static IndexBuffer* Create(uint32_t* indices, uint32_t size);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // BUFFER_HPP
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef GRAPHICS_CONTEXT_HPP
|
||||
#define GRAPHICS_CONTEXT_HPP
|
||||
|
||||
namespace OpenEngine {
|
||||
class GraphicsContext
|
||||
{
|
||||
public:
|
||||
virtual void Init() = 0;
|
||||
virtual void SwapBuffers() = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // GRAPHICS_CONTEXT_HPP
|
||||
43
open_engine/include/open_engine/renderer/render_command.hpp
Normal file
43
open_engine/include/open_engine/renderer/render_command.hpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef RENDER_COMMAND_HPP
|
||||
#define RENDER_COMMAND_HPP
|
||||
|
||||
#include "../renderer/renderer_api.hpp"
|
||||
#include "../opengl/opengl_renderer_api.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
namespace OpenEngine {
|
||||
class RenderCommand
|
||||
{
|
||||
public:
|
||||
inline static void Init()
|
||||
{
|
||||
api->Init();
|
||||
}
|
||||
|
||||
inline static void SetClearColor(const glm::vec4& color)
|
||||
{
|
||||
api->SetClearColor(color);
|
||||
}
|
||||
|
||||
inline static void Clear()
|
||||
{
|
||||
api->Clear();
|
||||
}
|
||||
|
||||
inline static void DrawIndexed(const std::shared_ptr<VertexArray>& vertex_array)
|
||||
{
|
||||
api->DrawIndexed(vertex_array);
|
||||
}
|
||||
|
||||
inline static void SetViewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height)
|
||||
{
|
||||
api->SetViewport(x, y, width, height);
|
||||
}
|
||||
|
||||
private:
|
||||
static inline RendererAPI* api = new OpenGLRendererAPI();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // RENDER_COMMAND_HPP
|
||||
39
open_engine/include/open_engine/renderer/renderer.hpp
Normal file
39
open_engine/include/open_engine/renderer/renderer.hpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef RENDERER_HPP
|
||||
#define RENDERER_HPP
|
||||
|
||||
#include "../renderer/renderer_api.hpp"
|
||||
#include "../renderer/vertex_array.hpp"
|
||||
#include "../orthographic_camera.hpp"
|
||||
#include <open_engine/renderer/shader.hpp>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
namespace OpenEngine {
|
||||
class Renderer
|
||||
{
|
||||
public:
|
||||
static void Init();
|
||||
|
||||
static void OnWindowResize(uint32_t width, uint32_t height);
|
||||
|
||||
static void BeginScene(const OrthographicCamera& camera);
|
||||
static void EndScene();
|
||||
|
||||
static void Submit(const Ref<Shader> shader,
|
||||
const Ref<VertexArray>& vertex_array,
|
||||
const glm::mat4& transform = glm::mat4(1.0f));
|
||||
|
||||
inline static RendererAPI::API GetApi() { return RendererAPI::GetAPI(); };
|
||||
|
||||
private:
|
||||
struct SceneData
|
||||
{
|
||||
glm::mat4 view_projection_matrix;
|
||||
};
|
||||
|
||||
inline static SceneData* scene_data = new SceneData;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // RENDERER_HPP
|
||||
34
open_engine/include/open_engine/renderer/renderer_api.hpp
Normal file
34
open_engine/include/open_engine/renderer/renderer_api.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef RENDERER_API_HPP
|
||||
#define RENDERER_API_HPP
|
||||
|
||||
#include "../renderer/vertex_array.hpp"
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace OpenEngine {
|
||||
class RendererAPI
|
||||
{
|
||||
public:
|
||||
enum class API {
|
||||
None,
|
||||
OpenGL
|
||||
};
|
||||
|
||||
virtual void Init() = 0;
|
||||
|
||||
virtual void SetViewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height) = 0;
|
||||
|
||||
virtual void SetClearColor(const glm::vec4& color) = 0;
|
||||
virtual void Clear() = 0;
|
||||
|
||||
virtual void DrawIndexed(const std::shared_ptr<VertexArray>& vertex_array) = 0;
|
||||
|
||||
static inline API GetAPI() { return api; };
|
||||
|
||||
private:
|
||||
static inline API api = RendererAPI::API::OpenGL;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // RENDERER_API_HPP
|
||||
41
open_engine/include/open_engine/renderer/shader.hpp
Normal file
41
open_engine/include/open_engine/renderer/shader.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef SHADER_HPP
|
||||
#define SHADER_HPP
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace OpenEngine {
|
||||
class Shader
|
||||
{
|
||||
public:
|
||||
static Ref<Shader> Create(const std::string& shader_path);
|
||||
static Ref<Shader> Create(const std::string& name, const std::string& vertex_src, const std::string& frament_src);
|
||||
|
||||
virtual ~Shader() = default;
|
||||
|
||||
virtual const std::string& GetName() const = 0;
|
||||
|
||||
virtual void Bind() const = 0;
|
||||
virtual void Unbind() const = 0;
|
||||
};
|
||||
|
||||
class ShaderLibrary
|
||||
{
|
||||
public:
|
||||
void Add(const Ref<Shader>& shader);
|
||||
void Add(const std::string& name, const Ref<Shader>& shader);
|
||||
Ref<Shader> Load(const std::string& path);
|
||||
Ref<Shader> Load(const std::string& name, const std::string& path);
|
||||
|
||||
Ref<Shader> Get(const std::string& name) const;
|
||||
|
||||
bool Exists(const std::string& name) const;
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, Ref<Shader>> shaders;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SHADER_HPP
|
||||
26
open_engine/include/open_engine/renderer/texture.hpp
Normal file
26
open_engine/include/open_engine/renderer/texture.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef TEXTURE_HPP
|
||||
#define TEXTURE_HPP
|
||||
|
||||
#include "open_engine/core.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
namespace OpenEngine {
|
||||
class Texture
|
||||
{
|
||||
public:
|
||||
virtual ~Texture() = default;
|
||||
|
||||
virtual uint32_t GetWidth() const = 0;
|
||||
virtual uint32_t GetHeight() const = 0;
|
||||
|
||||
virtual void Bind(uint32_t slot = 0) const = 0;
|
||||
};
|
||||
|
||||
class Texture2D : public Texture
|
||||
{
|
||||
public:
|
||||
static Ref<Texture2D> Create(const std::string& path);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TEXTURE_HPP
|
||||
27
open_engine/include/open_engine/renderer/vertex_array.hpp
Normal file
27
open_engine/include/open_engine/renderer/vertex_array.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef VERTEX_ARRAY_HPP
|
||||
#define VERTEX_ARRAY_HPP
|
||||
|
||||
#include "../renderer/buffer.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace OpenEngine {
|
||||
class VertexArray
|
||||
{
|
||||
public:
|
||||
virtual ~VertexArray() = default;
|
||||
|
||||
virtual void Bind() const = 0;
|
||||
virtual void UnBind() const = 0;
|
||||
|
||||
virtual void AddVertexBuffer(const std::shared_ptr<VertexBuffer>& vertex_buffer) = 0;
|
||||
virtual void SetIndexBuffer(const std::shared_ptr<IndexBuffer>& index_buffer) = 0;
|
||||
|
||||
virtual const std::vector<std::shared_ptr<VertexBuffer>>& GetVertexBuffers() const = 0;
|
||||
virtual const std::shared_ptr<IndexBuffer>& GetIndexBuffer() const = 0;
|
||||
|
||||
static VertexArray* Create();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // VERTEX_ARRAY_HPP
|
||||
42
open_engine/include/open_engine/window/linux_window.hpp
Normal file
42
open_engine/include/open_engine/window/linux_window.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef LINUX_WINDOW_HPP
|
||||
#define LINUX_WINDOW_HPP
|
||||
|
||||
#include <core.hpp>
|
||||
|
||||
#include <window/window.hpp>
|
||||
#include <renderer/graphics_context.hpp>
|
||||
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
namespace OpenEngine {
|
||||
class OE_API LinuxWindow
|
||||
: public Window
|
||||
{
|
||||
public:
|
||||
LinuxWindow(const WindowProps& props);
|
||||
virtual ~LinuxWindow();
|
||||
|
||||
void OnUpdate() override;
|
||||
|
||||
inline unsigned int GetWidth() const override { return data.width; }
|
||||
inline unsigned int GetHeight() const override { return data.height; }
|
||||
|
||||
inline void SetEventCallback(const EventCallbackFunction& callback) override
|
||||
{ data.event_callback = callback; }
|
||||
void SetVSync(bool enabled) override;
|
||||
bool IsVSync() const override;
|
||||
|
||||
inline virtual void* GetNativeWindow() const override { return gl_window; };
|
||||
|
||||
private:
|
||||
virtual void Init(const WindowProps& props);
|
||||
virtual void Shutdown();
|
||||
|
||||
WindowData data;
|
||||
GLFWwindow* gl_window;
|
||||
GraphicsContext* context;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // LINUX_WINDOW_HPP
|
||||
56
open_engine/include/open_engine/window/window.hpp
Normal file
56
open_engine/include/open_engine/window/window.hpp
Normal file
@@ -0,0 +1,56 @@
|
||||
#ifndef WINDOW_HPP
|
||||
#define WINDOW_HPP
|
||||
|
||||
#include "../core.hpp"
|
||||
#include "../events/event.hpp"
|
||||
#include <functional>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace OpenEngine {
|
||||
struct WindowProps
|
||||
{
|
||||
std::string title;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
|
||||
WindowProps(const std::string& title = "OpenEngine",
|
||||
unsigned int width = 1280,
|
||||
unsigned int height = 729)
|
||||
:title(title), width(width), height(height)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class OE_API Window
|
||||
{
|
||||
public:
|
||||
using EventCallbackFunction = std::function<void(Event&)>;
|
||||
|
||||
struct WindowData
|
||||
{
|
||||
std::string title;
|
||||
unsigned int width, height;
|
||||
bool vsync;
|
||||
|
||||
EventCallbackFunction event_callback;
|
||||
};
|
||||
|
||||
virtual ~Window() = default;
|
||||
|
||||
virtual void OnUpdate() = 0;
|
||||
|
||||
virtual unsigned int GetWidth() const = 0;
|
||||
virtual unsigned int GetHeight() const = 0;
|
||||
|
||||
virtual void SetEventCallback(const EventCallbackFunction& callback) = 0;
|
||||
virtual void SetVSync(bool enabled) = 0;
|
||||
virtual bool IsVSync() const = 0;
|
||||
|
||||
virtual void* GetNativeWindow() const = 0;
|
||||
|
||||
static Window* Create(const WindowProps& props = WindowProps());
|
||||
};
|
||||
}
|
||||
|
||||
#endif // WINDOW_HPP
|
||||
Reference in New Issue
Block a user