Filled out the todo list a bit

Gui_Panel_Refactor
Joeyrp 4 years ago
parent 7919f34d01
commit f8d2df5007

@ -1,14 +1,59 @@
Build System:
☐ Add a build option to do a build without the editor
Core: Core:
☐ Add log settings to the state file ☐ Add log settings to the state file
Graphics:
☐ Dear ImGui class with basic initialization
✔ Decide on a font/text rendering system @done (9/7/2021, 1:39:53 PM)
✔ Add FreeType to the project @done (9/7/2021, 2:23:13 PM)
✔ Add a new class for font loading/management and text rendering @done (9/7/2021, 3:57:08 PM)
✔ Make the text renderer smarter about breaking up words on multiple lines @low @done (9/8/2021, 2:23:03 PM)
☐ Implement the Image creation methods
Input:
☐ Port over the Element2D input system and adjust it to use glfw
Audio:
Scripting:
Script Managment class:
☐ Manage LUA states
☐ Initialize new scripts
Interface Class:
☐ Provide Methods that give access to the C++ code
Resource Managment:
Game:
☐ Load game project data
☐ Manage list of scenes
☐ Manage global scripts
Scene:
☐ Manage scene scripts
Manage list of Regions:
☐ Track which regions should be loaded
Region:
☐ List of renderable images for each layer
Game Object:
☐ List of components
Components:
☐ Transform
☐ Image
☐ Animation Controller
Animations:
☐ Animated Sprite class
Editor:
Graphics:
☐ Dear ImGui class with basic initialization
✔ Decide on a font/text rendering system @done (9/7/2021, 1:39:53 PM)
✔ Add FreeType to the project @done (9/7/2021, 2:23:13 PM)
✔ Add a new class for font loading/management and text rendering @done (9/7/2021, 3:57:08 PM)
☐ Make the text renderer smarter about breaking up words on multiple lines @low
Input:
☐ Port over the Element2D input system and adjust it to use glfw

@ -40,9 +40,11 @@ namespace lunarium
Logger::Log(LogCategory::CORE, LogLevel::INFO, "Lunarium is shutting down!"); Logger::Log(LogCategory::CORE, LogLevel::INFO, "Lunarium is shutting down!");
// Shutdown subsystems // Shutdown subsystems
mpInstance->mpGraphics->Shutdown();
delete mpInstance->mpGraphics; delete mpInstance->mpGraphics;
mpInstance->mpGraphics = nullptr; mpInstance->mpGraphics = nullptr;
mpInstance->mpWindow->Shutdown();
delete mpInstance->mpWindow; delete mpInstance->mpWindow;
mpInstance->mpWindow = nullptr; mpInstance->mpWindow = nullptr;
@ -171,6 +173,18 @@ namespace lunarium
mpWindow->SetShouldCloseFlag(true); mpWindow->SetShouldCloseFlag(true);
} }
// DEBUG: Graphics testing
static int width = 500;
if (glfwGetKey(mpWindow->GetWindow(), GLFW_KEY_LEFT) == GLFW_PRESS)
{
width -= 10;
}
if (glfwGetKey(mpWindow->GetWindow(), GLFW_KEY_RIGHT) == GLFW_PRESS)
{
width += 10;
}
// Update game state // Update game state
// Render // Render
@ -178,7 +192,7 @@ namespace lunarium
// DEBUG: Graphics tests // DEBUG: Graphics tests
mpGraphics->DrawFilledEllipse(glm::vec2(600, 300), glm::vec2(100, 150), Color(1.0f, 0.0f, 1.0f, 1.0f), 100); mpGraphics->DrawFilledEllipse(glm::vec2(600, 300), glm::vec2(100, 150), Color(1.0f, 0.0f, 1.0f, 1.0f), 100);
mpGraphics->DrawString("This is a test of the text renderer!", Rectangle(100, 200, 500, 300), mpGraphics->DrawString("This is a test of the text renderer!", Rectangle(100, 200, width, 300),
Color(0.0f, 1.0f, 1.0f, 1.0f), 0.5f, mpGraphics->DefaultFont()); Color(0.0f, 1.0f, 1.0f, 1.0f), 0.5f, mpGraphics->DefaultFont());
mpGraphics->EndDraw(); mpGraphics->EndDraw();

@ -170,20 +170,35 @@ namespace lunarium
int len = (int)strlen(text); int len = (int)strlen(text);
for (int c = 0; c < len; c++) for (int c = 0; c < len; c++)
{ {
Character ch = mFonts[fontID].CharSet[text[c]]; // if the last character was a space then we must
// be starting a new word
GLfloat advance = (ch.Advance >> 6) * scale; if (c > 0 && ' ' == text[c - 1])
if (curX + advance > botRight.x)
{ {
curX = topLeft.x; // check the total advance of this word to see if
curY += lineSize; // it would go beyond the right boundry
GLfloat totalAdvance = 0;
for (int i = c; text[i] != ' ' && text[i] != '\0'; i++)
{
Character ch = mFonts[fontID].CharSet[text[c]];
totalAdvance += (ch.Advance >> 6) * scale;
}
if (curX + totalAdvance > botRight.x)
{
curX = topLeft.x;
curY += lineSize;
}
if (curY + lineSize > botRight.y)
{
break;
}
} }
if (curY + lineSize > botRight.y)
{
break;
}
Character ch = mFonts[fontID].CharSet[text[c]];
GLfloat xpos = curX + ch.Bearing.x * scale; GLfloat xpos = curX + ch.Bearing.x * scale;
GLfloat ypos = curY + (mFonts[fontID].MaxHeight - ch.Size.Height) * scale; GLfloat ypos = curY + (mFonts[fontID].MaxHeight - ch.Size.Height) * scale;

@ -12,23 +12,9 @@
#include <iostream> #include <iostream>
#include <filesystem> #include <filesystem>
// TESTING
// #include <ft2build.h>
// #include FT_FREETYPE_H
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
// TESTING -- FREETYPE
// FT_Library ft;
// if (FT_Init_FreeType(&ft))
// {
// std::cout << "Could not init FreeType Library\n";
// return -1;
// }
// std::cout << "Freetype library sucessfully initialized!\n";
////////////////
// Switch the currrent working directory to the directory // Switch the currrent working directory to the directory
// containing the lunarium.exe file because the data and state // containing the lunarium.exe file because the data and state
// file should be in that location // file should be in that location

Loading…
Cancel
Save