12 #include "../jugimap/jugimap.h"
32 if(agk::GetFileExists(fileName.c_str())){
33 agkId = agk::OpenToRead(fileName.c_str());
43 bool IsOpen()
override {
return opened; }
44 int Pos()
override {
return agk::GetFilePos(agkId); }
45 void Seek(
int _pos)
override { agk::SetFilePos(agkId, _pos); }
46 int Size()
override {
return agk::GetFileSize(agkId); }
47 void Close()
override { agk::CloseFile(agkId); }
52 unsigned char value = agk::ReadByte(agkId);
58 int value = agk::ReadInteger(agkId);
64 float value = agk::ReadFloat(agkId);
70 char *str = agk::ReadString2(agkId);
71 std::string value(str);
72 agk::DeleteString(str);
79 unsigned int agkId = 0;
92 if(agk::GetFileExists(fileName.c_str())){
93 agkId = agk::OpenToRead(fileName.c_str());
111 bool IsOpen()
override {
return opened; }
112 bool Eof()
override {
return agk::FileEOF(agkId);}
113 void Close()
override {
if(opened) agk::CloseFile(agkId); }
118 char *c = agk::ReadLine(agkId);
120 agk::DeleteString(c);
125 unsigned int agkId = 0;
141 virtual void Init()
override;
143 int GetAgkId()
const {
return agkId;}
146 unsigned int agkId = 0;
162 virtual void Init()
override;
164 int GetAgkId()
const {
return agkId;}
167 unsigned int agkId = 0;
180 friend class StandardSpriteFrameAnimationPlayer;
193 int GetAgkId(){
return agkId;}
197 unsigned int agkId = 0;
198 unsigned int shaderAgkId = 0;
200 void ManageShaders_OverlayColor();
216 int GetAgkId(){
return agkId;}
225 class ColliderAGK :
public Collider
229 ColliderAGK(StandardSprite* _standardSprite);
231 virtual Kind GetKind(){
return Kind::SINGLE_SHAPE; }
232 virtual void AddShapes()
override;
233 virtual void UpdateShapes(
const AffineMat3f &m)
override;
234 virtual void ClearShapes()
override;
235 virtual int GetShapesCount()
override;
236 virtual bool PointInside(
Vec2f _pos)
override;
237 virtual bool Overlaps(Collider *_otherCollider)
override;
238 virtual bool RaycastHit(
Vec2f _rayStart,
Vec2f _rayEnd,
Vec2f &_hitPos)
override;
270 int GetAgkId(){
return agkId;}
273 unsigned int agkId = 0;
302 MapAGK(
int _zOrderStart) :
Map(_zOrderStart) {}
352 FontAGK(
const std::string &_relativeFilePath,
int _size,
FontKind _kind);
355 int GetAgkId(){
return agkId; }
358 virtual int GetPixelWidth(
const std::string &s)
override;
359 virtual int GetPixelHeight(
const std::string &s)
override;
360 virtual Vec2f GetPixelSize(
const std::string &s)
override;
364 int agkProbeTextId = 0;
388 int agkOutlineColor = 0;
396 class ShaderAGK_ColorBlend_SimpleMultiply;
397 class ShaderAGK_ColorBlend_Normal;
398 class ShaderAGK_ColorBlend_Multiply;
399 class ShaderAGK_ColorBlend_LinearDodge;
400 class ShaderAGK_ColorBlend_Color;
403 class FragmentShaderAGK_ColorBlend
408 friend class ShaderAGK_ColorBlend_SimpleMultiply;
409 friend class ShaderAGK_ColorBlend_Normal;
410 friend class ShaderAGK_ColorBlend_Multiply;
411 friend class ShaderAGK_ColorBlend_LinearDodge;
412 friend class ShaderAGK_ColorBlend_Color;
415 virtual ~FragmentShaderAGK_ColorBlend();
416 void Load(
const std::string &_filePath);
418 unsigned int GetAgkId(){
return agkId;}
421 unsigned int agkId = 0;
424 ColorRGBA colorRGBA{255, 255, 255, 128};
425 std::string colorRGBAname =
"overlayColor";
430 class ShaderAGK_ColorBlend_SimpleMultiply :
public FragmentShaderAGK_ColorBlend
434 class ShaderAGK_ColorBlend_Normal :
public FragmentShaderAGK_ColorBlend
438 class ShaderAGK_ColorBlend_Multiply :
public FragmentShaderAGK_ColorBlend
442 class ShaderAGK_ColorBlend_LinearDodge :
public FragmentShaderAGK_ColorBlend
446 class ShaderAGK_ColorBlend_Color :
public FragmentShaderAGK_ColorBlend
453 extern ShaderAGK_ColorBlend_SimpleMultiply* colorBlend_SimpleMultiply;
454 extern ShaderAGK_ColorBlend_Normal* colorBlend_Normal;
455 extern ShaderAGK_ColorBlend_Multiply* colorBlend_Multiply;
456 extern ShaderAGK_ColorBlend_LinearDodge* colorBlend_LinearDodge;
457 extern ShaderAGK_ColorBlend_Color* colorBlend_Color;
459 void LoadJugimapShaders();
460 void DeleteShaders();
471 struct KeyboardConversionTable
474 KeyboardConversionTable();
476 std::vector<jugimap::KeyCode>table;
480 extern KeyboardConversionTable keyboardConversionTable;
515 return new FontAGK(_relativeFilePath, _size, _fontKind);
522 return new MapAGK(_zOrderStart);
GraphicFile * NewFile() override
Returns a new graphic file object.
Definition: jmAGK.h:499
virtual void UpdateEngineObjects() override
Update the engine sprite.
Definition: jmAGK.cpp:475
Extended EngineApp class for AGK.
Definition: jmAGK.h:332
AffineMat3< float > AffineMat3f
AffineMat3 struct in float precision.
Definition: jmCommon.h:381
void SetPhysicsMode(PhysicsMode _physicsMode) override
Set the physics mode to the given *_physicsMode*.
Definition: jmAGK.cpp:411
virtual void Dot(jugimap::Vec2f p) override
Draw a dot at the given position p.
Definition: jmAGK.cpp:1075
void ReadLine(std::string &s) override
Returns true if the stream of this object is open for reading; if not it returns false.
Definition: jmAGK.h:116
Extended TextStreamReader class for AGK.
Definition: jmAGK.h:86
void Close() override
Close the stream.
Definition: jmAGK.h:113
Extended BinaryStreamReader class for AGK.
Definition: jmAGK.h:22
virtual void InitEngineObjects() override
Initialize the engine sprite.
Definition: jmAGK.cpp:443
virtual void RectangleOutline(const jugimap::Rectf &rect) override
Draw the outline of the given rectangle rect.
Definition: jmAGK.cpp:1058
PhysicsMode
The physics mode of the standard sprite.
Definition: jmSprites.h:794
SkeletonSprite * NewSpineSprite() override
Returns a new spine object.
Definition: jmAGK.h:509
void SetVisible(bool _visible) override
Set the visibility of this sprite.
Definition: jmAGK.cpp:760
Color in RGBA color space - integer variant.
Definition: jmColor.h:15
The EngineScene class defines engine specific scene properties.
Definition: jmScene.h:109
The App is the base class of the application.
Definition: jmApp.h:22
The Scene class is the base class for the application scenes.
Definition: jmScene.h:23
Extended Drawer class for AGK.
Definition: jmAGK.h:374
bool Eof() override
Returns true if the end of file is reached; if not it returns false.
Definition: jmAGK.h:112
Extended SkeletonSprite class for AGK.
Definition: jmAGK.h:255
bool IsOpen() override
Returns true if the stream of this object is open for reading; if not it returns false.
Definition: jmAGK.h:111
The GraphicItem class defines the equivalent object from JugiMap Editor.
Definition: jmSourceGraphics.h:34
The EngineApp class defines engine specific application properties.
Definition: jmApp.h:115
virtual void Init() override
Initialize this graphic item.
Definition: jmAGK.cpp:26
int Size() override
Returns the size of the stream.
Definition: jmAGK.h:46
StandardSprite * NewStandardSprite() override
Returns a new standard sprite object.
Definition: jmAGK.h:503
virtual void EllipseOutline(jugimap::Vec2f c, jugimap::Vec2f r) override
Draw the outline of an ellipse defined by the given center point c and radius r.
Definition: jmAGK.cpp:1067
The base abstract class for reading binary streams.
Definition: jmStreams.h:33
virtual bool IsEngineSpriteInitialized() override
Returns true if the engine sprite of this sprite has been initialized; otherwise returns false.
Definition: jmAGK.h:189
Map()
Constructor.
Definition: jmMap.h:34
The StandardSprite class defines the sprite from JugiMap Editor.
Definition: jmSprites.h:787
EngineScene * NewEngineScene(Scene *_scene) override
Returns a new map object.
Definition: jmAGK.h:525
void UpdateEngineObjects() override
Update the engine map objects.
Definition: jmAGK.cpp:820
The base abstract class for reading text streams.
Definition: jmStreams.h:194
void UpdateEngineObjects() override
Update all engine objects related to this layer and its content.
Definition: jmAGK.cpp:774
virtual bool IsEngineSpriteInitialized() override
Returns true if the engine sprite of this sprite has been initialized; otherwise returns false.
Definition: jmAGK.h:214
int ReadInt() override
Read and returns the integer number (4 bytes).
Definition: jmAGK.h:56
virtual void SetActiveImage(GraphicItem *_image) override
Set the active image to the given *_image*.
Definition: jmAGK.cpp:154
FontKind
The kinds of font.
Definition: jmGlobal.h:124
void Close() override
Close the stream.
Definition: jmAGK.h:47
The GraphicFile class defines the equivalent object from JugiMap Editor.
Definition: jmSourceGraphics.h:148
Drawer * NewDrawer() override
Returns a new drawer object.
Definition: jmAGK.h:518
std::string ReadString() override
Read and returns the string. The length of string is written as the integer at the start.
Definition: jmAGK.h:68
SpriteLayer * NewSpriteLayer() override
Returns a new sprite layer object.
Definition: jmAGK.h:507
float ReadFloat() override
Read and returns the float number (4 bytes).
Definition: jmAGK.h:62
Extended Font class for AGK.
Definition: jmAGK.h:348
virtual void InitEngineObjects() override
Initialize the engine sprite.
Definition: jmAGK.cpp:108
Vec2< float > Vec2f
Vec2 struct in float precision.
Definition: jmCommon.h:167
Map * NewMap(int _zOrderStart) override
Returns a new map object.
Definition: jmAGK.h:520
The Drawer is the base drawer class.
Definition: jmDrawing.h:20
The SkeletonSprite class defines the skeleton sprite from JugiMap Editor.
Definition: jmSprites.h:1011
Extended ObjectFactory class for AGK.
Definition: jmAGK.h:489
void InitEngineObjects() override
Initialize the engine sprite.
Definition: jmAGK.cpp:719
Extended StandardSprite class for AGK.
Definition: jmAGK.h:176
void PreUpdate() override
Interface function for running engine specific code before the scene update.
Definition: jmAGK.cpp:844
Extended TextSprite class for AGK.
Definition: jmAGK.h:207
void UpdateEngineObjects() override
Update the engine sprite.
Definition: jmAGK.cpp:754
GraphicItem * NewItem() override
Returns a new graphic item object.
Definition: jmAGK.h:501
void Seek(int _pos) override
Set the current reading position of the stream.
Definition: jmAGK.h:45
Extended SpriteLayer class for AGK.
Definition: jmAGK.h:283
Font * NewFont(const std::string &_relativeFilePath, int _size, FontKind _fontKind) override
Returns a new text object.
Definition: jmAGK.h:513
virtual void SetOutlineColor(ColorRGBA _outlineColor) override
Set outline color to the given *_outlineColor*.
Definition: jmAGK.cpp:1041
unsigned char ReadByte() override
Read and returns the byte number.
Definition: jmAGK.h:50
The Font class defines fonts used in TextSprite objects.
Definition: jmFont.h:16
EngineApp * NewEngineApp(App *_app) override
Returns a new map object.
Definition: jmAGK.h:530
virtual void UpdateEngineObjects() override
Update the engine sprite.
Definition: jmAGK.cpp:207
The ObjectFactory is the base class for engine specific object factories.
Definition: jmObjectFactory.h:48
Extended GraphicFile class for AGK.
Definition: jmAGK.h:155
Extended GraphicItem class for AGK.
Definition: jmAGK.h:134
virtual void Init() override
Initialize this GraphicFile.
Definition: jmAGK.cpp:65
void SetVisible(bool _visible) override
Set the visibility of this map.
Definition: jmAGK.cpp:803
bool IsOpen() override
Returns true if the stream of this object is open for reading; if not it returns false.
Definition: jmAGK.h:43
BinaryFileStreamReaderAGK(const std::string &fileName)
Constructor.
Definition: jmAGK.h:30
Extended Map class for AGK.
Definition: jmAGK.h:297
TextSprite * NewTextSprite() override
Returns a new standard sprite object.
Definition: jmAGK.h:505
Extended EngineScene class for AGK.
Definition: jmAGK.h:316
The TextSprite class defines the text sprite from JugiMap Editor.
Definition: jmSprites.h:889
void SetSystemMouseCursorVisible(bool _visible) override
Set the visibility of the system mouse cursor.
Definition: jmAGK.cpp:964
SkeletonSprite * NewSpriterSprite() override
Returns a new spriter object.
Definition: jmAGK.h:511
The JugiMapBinaryLoader class loads data from jugimap binary files (.jmb).
Definition: jmMapBinaryLoader.h:37
The Map class defines the map element from JugiMap Editor.
Definition: jmMap.h:26
int Pos() override
Returns the current reading position of the stream.
Definition: jmAGK.h:44
The SpriteLayer class defines the sprite and tile layers from JugiMap Editor.
Definition: jmLayers.h:303
virtual void Line(jugimap::Vec2f p1, jugimap::Vec2f p2) override
Draw a line from the given position p1 to p2.
Definition: jmAGK.cpp:1047
void UpdateEngineDrawer() override
Update engine objects related to this drawer.
Definition: jmAGK.cpp:1033