添加opengl框架并测试渲染第一个三角形

This commit is contained in:
2025-04-21 13:29:10 +08:00
parent 899c62bfeb
commit ffc50ef8a7
25 changed files with 8524 additions and 73 deletions

View File

@ -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;