1:1 source port of the engine and game code; Windows build and system layer; docs. No game files or SDK headers.

This commit is contained in:
CRTkafa 2026-10-22 16:30:40 +08:00
parent c3b032a45a
commit 0ecb47e9cb
3871 changed files with 91080 additions and 1640063 deletions

View file

@ -1,40 +0,0 @@
#pragma once
#include <SDL3/SDL.h>
#include <SDL3_ttf/SDL_ttf.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include "core/vfs.h"
namespace choco {
// Image cache and ordered 2D draw calls in the fixed 800x600 coordinate space.
class Draw {
public:
Draw(SDL_Renderer* renderer, const Vfs& assets);
~Draw();
Draw(const Draw&) = delete;
Draw& operator=(const Draw&) = delete;
SDL_Texture* load(const std::string& path);
bool image(const std::string& path, const SDL_FRect& destination);
bool image(const std::string& path, const SDL_FRect* source, const SDL_FRect& destination);
bool text(const std::string& utf8, float x, float y, SDL_Color color,
int pointSize = 16, float alignWidth = 0, bool center = false,
const std::string& fontName = "", int outlineSize = 0,
SDL_Color outlineColor = {0, 0, 0, 255});
void clear();
private:
SDL_Renderer* renderer_;
const Vfs& assets_;
std::unordered_map<std::string, SDL_Texture*> textures_;
std::unordered_map<std::string, SDL_Texture*> textTextures_;
std::unordered_map<std::string, Bytes> vectorFonts_;
std::unordered_map<std::string, TTF_Font*> sizedFonts_;
std::unordered_set<std::string> warnedVectorFonts_;
bool ttfReady_ = false;
};
} // namespace choco