Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "imgui/imgui.h"
- #include "imgui/imgui_internal.h"
- #include "Renderer.h"
- Renderer* Renderer::m_pInstance;
- Renderer::Renderer()
- {
- }
- Renderer::~Renderer()
- {
- }
- void Renderer::Initialize()
- {
- ImGuiIO& io = ImGui::GetIO();
- }
- void Renderer::BeginScene()
- {
- ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.0f, 0.0f, 0.0f, 0.0f));
- ImGui::Begin("BackBuffer", reinterpret_cast<bool*>(true), ImVec2(0, 0), 0.0f, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoInputs);
- ImGui::SetWindowPos(ImVec2(0, 0), ImGuiSetCond_Always);
- ImGui::SetWindowSize(ImVec2(ImGui::GetIO().DisplaySize.x, ImGui::GetIO().DisplaySize.y), ImGuiSetCond_Always);
- }
- void Renderer::DrawScene()
- {
- ImGuiIO& io = ImGui::GetIO();
- }
- void Renderer::EndScene()
- {
- ImGuiWindow* window = ImGui::GetCurrentWindow();
- window->DrawList->PushClipRectFullScreen();
- ImGui::End();
- ImGui::PopStyleColor();
- }
- void Renderer::DrawLine(const ImVec2& from, const ImVec2& to, uint32_t color, float thickness)
- {
- ImGuiWindow* window = ImGui::GetCurrentWindow();
- float a = (color >> 24) & 0xff;
- float r = (color >> 16) & 0xff;
- float g = (color >> 8) & 0xff;
- float b = (color) & 0xff;
- window->DrawList->AddLine(from, to, ImGui::GetColorU32(ImVec4(r / 255, g / 255, b / 255, a / 255)), thickness);
- }
- void Renderer::DrawCircle(const ImVec2& position, float radius, uint32_t color, float thickness)
- {
- ImGuiWindow* window = ImGui::GetCurrentWindow();
- float a = (color >> 24) & 0xff;
- float r = (color >> 16) & 0xff;
- float g = (color >> 8) & 0xff;
- float b = (color) & 0xff;
- window->DrawList->AddCircle(position, radius, ImGui::GetColorU32(ImVec4(r / 255, g / 255, b / 255, a / 255)), 12, thickness);
- }
- void Renderer::DrawCircleFilled(const ImVec2& position, float radius, uint32_t color)
- {
- ImGuiWindow* window = ImGui::GetCurrentWindow();
- float a = (color >> 24) & 0xff;
- float r = (color >> 16) & 0xff;
- float g = (color >> 8) & 0xff;
- float b = (color) & 0xff;
- window->DrawList->AddCircleFilled(position, radius, ImGui::GetColorU32(ImVec4(r / 255, g / 255, b / 255, a / 255)), 12);
- }
- Renderer* Renderer::GetInstance()
- {
- if (!m_pInstance)
- m_pInstance = new Renderer();
- return m_pInstance;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement