Rename AppData to AppState

This commit is contained in:
Graham Pentheny
2026-02-02 18:32:07 -05:00
parent 3d0aedec33
commit a9ee01e64f
4 changed files with 15 additions and 17 deletions

View File

@@ -11,7 +11,7 @@ class TestCase;
class Sample;
class InputGeom;
struct AppData
struct AppState
{
SDL_Window* window;
SDL_GLContext glContext;

View File

@@ -1,11 +1,11 @@
#pragma once
#include "AppState.h"
#include <imgui.h>
#include <stdio.h>
#include "AppData.h"
extern AppData app;
extern AppState app;
inline void DrawScreenspaceText(float x, float y, ImU32 color, const char* text, bool centered = false)
{

View File

@@ -1,9 +1,7 @@
#include "AppData.h"
#include "AppState.h"
#include "InputGeom.h"
#include "Sample.h"
#include "SDL_opengl.h"
#include "Sample.h"
#ifdef __APPLE__
# include <OpenGL/glu.h>
@@ -13,7 +11,7 @@
#include <imgui.h>
void AppData::resetCamera()
void AppState::resetCamera()
{
// Reset camera and fog to match the mesh bounds.
if (inputGeometry)
@@ -38,7 +36,7 @@ void AppData::resetCamera()
glFogf(GL_FOG_END, camr * 1.25f);
}
void AppData::updateWindowSize()
void AppState::updateWindowSize()
{
SDL_GetWindowSize(window, &width, &height);
SDL_GL_GetDrawableSize(window, &drawableWidth, &drawableHeight);
@@ -52,7 +50,7 @@ void AppData::updateWindowSize()
glGetDoublev(GL_PROJECTION_MATRIX, projectionMatrix);
}
void AppData::updateUIScale() const
void AppState::updateUIScale() const
{
ImGuiIO& io = ImGui::GetIO();
io.DisplaySize = ImVec2(static_cast<float>(width), static_cast<float>(height));
@@ -61,7 +59,7 @@ void AppData::updateUIScale() const
static_cast<float>(drawableHeight) / static_cast<float>(height));
}
void AppData::worldToScreen(float x, float y, float z, float* screenX, float* screenY) const
void AppState::worldToScreen(float x, float y, float z, float* screenX, float* screenY) const
{
GLdouble modelviewMatrix[16];
glGetDoublev(GL_MODELVIEW_MATRIX, modelviewMatrix);

View File

@@ -16,7 +16,7 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "AppData.h"
#include "AppState.h"
#include "InputGeom.h"
#include "SDL.h"
#include "SDL_keycode.h"
@@ -28,13 +28,13 @@
#include "TestCase.h"
#include "imguiHelpers.h"
#include <functional>
#include <string>
#include <imgui.h>
#include <imgui_impl_opengl2.h>
#include <imgui_impl_sdl2.h>
#include <implot.h>
#include <functional>
#include <string>
#ifdef __APPLE__
# include <OpenGL/glu.h>
#else
@@ -68,7 +68,7 @@ constexpr ImGuiWindowFlags staticWindowFlags = ImGuiWindowFlags_NoMove
| ImGuiWindowFlags_NoCollapse;
}
AppData app;
AppState app;
int main(int /*argc*/, char** /*argv*/)
{