From ce45c560586f991b427471ba206edf48881baab5 Mon Sep 17 00:00:00 2001 From: TravisBot <> Date: Fri, 22 Sep 2017 00:09:02 +0000 Subject: Rebuilding documentation --- spritesheet_8h_source.html | 250 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 250 insertions(+) create mode 100644 spritesheet_8h_source.html (limited to 'spritesheet_8h_source.html') diff --git a/spritesheet_8h_source.html b/spritesheet_8h_source.html new file mode 100644 index 00000000..cdff0a6a --- /dev/null +++ b/spritesheet_8h_source.html @@ -0,0 +1,250 @@ + + + + + + +YAGE: yage/base/spritesheet.h Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
YAGE +  v0.1.1 +
+
Yet Another Game Engine
+
+
+ + + + + +
+
+ +
+
+
+ +
+ +
+ All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
+ + +
+ +
+ +
+
+
spritesheet.h
+
+
+Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
+
2  * spritesheet.h
+
3  *
+
4  * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
+
5  * MIT License, see LICENSE file for more details.
+
6  * ----------------------------------------------------------------------------
+
7  */
+
8 
+
9 #ifndef YAGE_SPRITESHEET_H
+
10 #define YAGE_SPRITESHEET_H
+
11 
+
12 #include "texture.h"
+
13 
+
14 #include <rapidjson/reader.h>
+
15 
+
16 #include <map>
+
17 #include <string>
+
18 
+
19 namespace yage
+
20 {
+
21 
+
22 namespace details
+
23 {
+
24 
+
25 struct Coordinate {
+
26  int x;
+
27  int y;
+
28  int width;
+
29  int height;
+
30 
+
31  Coordinate() = default;
+
32 
+
33  Coordinate(int x_i, int y_i, int width_i, int height_i)
+
34  : x(x_i), y(y_i), width(width_i), height(height_i)
+
35  {
+
36  }
+
37 };
+
38 
+
39 typedef std::map<std::string, details::Coordinate> SpriteMap;
+
40 
+ +
42  : public rapidjson::BaseReaderHandler<rapidjson::UTF8<>, SpriteSheetHandler>
+
43 {
+
44 public:
+
45  bool Null();
+
46  bool Bool(bool b);
+
47  bool Int(int i);
+
48  bool Uint(unsigned u);
+
49  bool Int64(int64_t i);
+
50  bool Uint64(uint64_t u);
+
51  bool Double(double d);
+
52  bool String(const char *str, rapidjson::SizeType length, bool copy);
+
53 
+
54  bool Key(const char *str, rapidjson::SizeType length, bool copy);
+
55  bool StartObject();
+
56  bool EndObject(rapidjson::SizeType memberCount);
+
57  bool StartArray();
+
58  bool EndArray(rapidjson::SizeType memberCount);
+
59 
+
60  SpriteMap spriteMap() const;
+
61 
+
62 private:
+
63  std::string current_key_;
+
64  std::string current_image_;
+ +
66  int depth_;
+ + + +
70 
+
71  bool handleNumber(int i);
+
72 };
+
73 
+
74 } // namespace details
+
75 
+ +
77 {
+
78 public:
+
79  SpriteSheet(std::string pngFileName, std::string jsonFileName);
+
80 
+
81  void sprite(std::string spriteName) const;
+
82 
+
83 private:
+ + +
86 };
+
87 
+
88 } // namespace yage
+
89 
+
90 #endif
+
Coordinate coord_
Definition: spritesheet.h:65
+
bool handleNumber(int i)
Definition: spritesheet.cpp:98
+
Definition: spritesheet.h:76
+
int image_width_
Definition: spritesheet.h:67
+
Coordinate(int x_i, int y_i, int width_i, int height_i)
Definition: spritesheet.h:33
+
Definition: spritesheet.h:41
+
bool Uint64(uint64_t u)
Definition: spritesheet.cpp:42
+
bool Null()
Definition: spritesheet.cpp:17
+
SpriteSheet(std::string pngFileName, std::string jsonFileName)
+
int depth_
Definition: spritesheet.h:66
+
bool String(const char *str, rapidjson::SizeType length, bool copy)
Definition: spritesheet.cpp:52
+
SpriteMap spriteMap() const
Definition: spritesheet.cpp:93
+ +
bool StartArray()
Definition: spritesheet.cpp:83
+
bool Key(const char *str, rapidjson::SizeType length, bool copy)
Definition: spritesheet.cpp:57
+
std::string current_image_
Definition: spritesheet.h:64
+
int x
Definition: spritesheet.h:26
+
bool EndArray(rapidjson::SizeType memberCount)
Definition: spritesheet.cpp:88
+ +
std::map< std::string, details::Coordinate > SpriteMap
Definition: spritesheet.h:39
+
Texture texture_
Definition: spritesheet.h:84
+
int width
Definition: spritesheet.h:28
+
void sprite(std::string spriteName) const
+
int height
Definition: spritesheet.h:29
+
int image_height_
Definition: spritesheet.h:68
+
bool StartObject()
Definition: spritesheet.cpp:63
+
bool EndObject(rapidjson::SizeType memberCount)
Definition: spritesheet.cpp:74
+
bool Double(double d)
Definition: spritesheet.cpp:47
+
std::string current_key_
Definition: spritesheet.h:63
+
bool Int(int i)
Definition: spritesheet.cpp:27
+
Definition: texture.h:17
+
Definition: spritesheet.h:25
+
int y
Definition: spritesheet.h:27
+
bool Uint(unsigned u)
Definition: spritesheet.cpp:32
+
SpriteMap map_
Definition: spritesheet.h:69
+
bool Bool(bool b)
Definition: spritesheet.cpp:22
+
bool Int64(int64_t i)
Definition: spritesheet.cpp:37
+
details::SpriteMap fileLocations_
Definition: spritesheet.h:85
+
+
+ + + + -- cgit