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:
parent
c3b032a45a
commit
0ecb47e9cb
3871 changed files with 91080 additions and 1640063 deletions
|
|
@ -1,35 +0,0 @@
|
|||
#pragma once
|
||||
#include "core/vfs.h"
|
||||
#include <SDL3/SDL.h>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace choco {
|
||||
|
||||
struct CharacterFrame {
|
||||
int x=0, y=0, w=0, h=0, regx=0, regy=0;
|
||||
};
|
||||
|
||||
// Frame 0 is the full portrait; later frames are expressions aligned by regx/regy.
|
||||
bool parseCharacterFrames(std::string_view xml, std::vector<CharacterFrame>& frames,
|
||||
std::string* error=nullptr);
|
||||
|
||||
class CharacterAtlas {
|
||||
public:
|
||||
CharacterAtlas()=default;
|
||||
~CharacterAtlas();
|
||||
CharacterAtlas(const CharacterAtlas&)=delete;
|
||||
CharacterAtlas& operator=(const CharacterAtlas&)=delete;
|
||||
bool load(SDL_Renderer* renderer,const Vfs& assets,std::string_view name,
|
||||
std::string* error=nullptr);
|
||||
bool draw(SDL_Renderer* renderer,float x,float y,size_t expression=0,
|
||||
Uint8 alpha=255) const;
|
||||
const std::vector<CharacterFrame>& frames() const { return frames_; }
|
||||
SDL_Texture* texture() const { return texture_; }
|
||||
private:
|
||||
SDL_Texture* texture_=nullptr;
|
||||
std::vector<CharacterFrame> frames_;
|
||||
};
|
||||
|
||||
} // namespace choco
|
||||
Loading…
Add table
Add a link
Reference in a new issue