space-game001/src/Environment.h
2026-04-04 14:29:20 +03:00

55 lines
1.3 KiB
C++

#pragma once
#ifdef __linux__
#include <SDL2/SDL.h>
#endif
#ifndef __ANDROID__
#include "render/OpenGlExtensions.h"
#endif
#include <Eigen/Dense>
namespace ZL {
#ifdef EMSCRIPTEN
using std::min;
using std::max;
#endif
constexpr float DEFAULT_ZOOM = 36.f;
class Environment {
public:
static constexpr int CONST_DEFAULT_WIDTH = 1280;
static constexpr int CONST_DEFAULT_HEIGHT = 720;
static int windowHeaderHeight;
static int width;
static int height;
static float zoom;
static Eigen::Matrix3f inverseShipMatrix;
static SDL_Window* window;
static bool showMouse;
static bool exitGameLoop;
static bool tapDownHold;
static Eigen::Vector2f tapDownStartPos;
static Eigen::Vector2f tapDownCurrentPos;
static const float CONST_Z_NEAR;
static const float CONST_Z_FAR;
// Virtual projection dimensions used for all 2D/UI rendering.
// These maintain the screen's actual aspect ratio but normalize the
// height to 720 (landscape) or width to 720 (portrait), giving a
// consistent coordinate space regardless of physical screen resolution.
static float projectionWidth;
static float projectionHeight;
// Call this once at startup and whenever the window is resized.
static void computeProjectionDimensions();
};
} // namespace ZL