添加opengl框架并测试渲染第一个三角形
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
set(PROJECT_NAME "Sandbox")
|
||||
project(${PROJECT_NAME})
|
||||
|
||||
|
||||
file(GLOB_RECURSE SOURCES "src/*.cpp")
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Hazel)
|
||||
|
||||
|
||||
@ -1,17 +1,55 @@
|
||||
#include <Hazel.h>
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_sdl2.h"
|
||||
#include "imgui_impl_opengl3.h"
|
||||
|
||||
|
||||
class ExampleLayer : public Hazel::Layer
|
||||
{
|
||||
public:
|
||||
ExampleLayer() : Layer("ExampleLayer")
|
||||
{
|
||||
}
|
||||
|
||||
void OnUpdate() override
|
||||
{
|
||||
}
|
||||
|
||||
void OnEvent(SDL_Event& event) override
|
||||
{
|
||||
if (event.type == SDL_EVENT_KEY_DOWN)
|
||||
{
|
||||
HZ_CORE_TRACE("{}", event.key.key);
|
||||
}
|
||||
}
|
||||
|
||||
void OnImGuiRender() override
|
||||
{
|
||||
ImGui::Begin("Hazel Layer");
|
||||
ImGui::Text("Hello World");
|
||||
ImGui::End();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
class Sandbox : public Hazel::Application
|
||||
{
|
||||
public:
|
||||
Sandbox();
|
||||
Sandbox()
|
||||
{
|
||||
PushLayer(new ExampleLayer());
|
||||
}
|
||||
~Sandbox();
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
Sandbox::Sandbox() = default;
|
||||
|
||||
Sandbox::~Sandbox() = default;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user