diff options
author | chai <chaifix@163.com> | 2018-10-19 08:36:44 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-10-19 08:36:44 +0800 |
commit | 7d5f055547e70fa93ee9ac944e62f8d657b9dc55 (patch) | |
tree | 081782a1541854db4b8eb69c4b43081f52711286 /src/libjin/Graphics | |
parent | 02dd1f38008594048f0e28bad01e7c6d18844198 (diff) |
*修改文件名
Diffstat (limited to 'src/libjin/Graphics')
-rw-r--r-- | src/libjin/Graphics/Font/Decoder.h | 44 | ||||
-rw-r--r-- | src/libjin/Graphics/Font/Page.h | 38 | ||||
-rw-r--r-- | src/libjin/Graphics/Font/je_decoder.cpp (renamed from src/libjin/Graphics/Font/Decoder.cpp) | 2 | ||||
-rw-r--r-- | src/libjin/Graphics/Font/je_decoder.h | 88 | ||||
-rw-r--r-- | src/libjin/Graphics/Font/je_font.h (renamed from src/libjin/Graphics/Font/Font.h) | 6 | ||||
-rw-r--r-- | src/libjin/Graphics/Font/je_page.h | 51 | ||||
-rw-r--r-- | src/libjin/Graphics/Font/je_text.cpp (renamed from src/libjin/Graphics/Font/Text.cpp) | 4 | ||||
-rw-r--r-- | src/libjin/Graphics/Font/je_text.h (renamed from src/libjin/Graphics/Font/Text.h) | 15 | ||||
-rw-r--r-- | src/libjin/Graphics/Font/je_texture_font.cpp (renamed from src/libjin/Graphics/Font/TextureFont.cpp) | 8 | ||||
-rw-r--r-- | src/libjin/Graphics/Font/je_texture_font.h (renamed from src/libjin/Graphics/Font/TextureFont.h) | 23 | ||||
-rw-r--r-- | src/libjin/Graphics/Font/je_ttf.cpp (renamed from src/libjin/Graphics/Font/TTF.cpp) | 18 | ||||
-rw-r--r-- | src/libjin/Graphics/Font/je_ttf.h (renamed from src/libjin/Graphics/Font/TTF.h) | 16 | ||||
-rw-r--r-- | src/libjin/Graphics/Graphics.h | 21 | ||||
-rw-r--r-- | src/libjin/Graphics/Shader/je_base.shader.h (renamed from src/libjin/Graphics/Shader/base.shader.h) | 0 | ||||
-rw-r--r-- | src/libjin/Graphics/Shader/je_default.shader.h (renamed from src/libjin/Graphics/Shader/default.shader.h) | 0 | ||||
-rw-r--r-- | src/libjin/Graphics/Shader/je_font.shader.h (renamed from src/libjin/Graphics/Shader/font.shader.h) | 0 | ||||
-rw-r--r-- | src/libjin/Graphics/Shader/je_shader.cpp (renamed from src/libjin/Graphics/Shader/Shader.cpp) | 12 | ||||
-rw-r--r-- | src/libjin/Graphics/Shader/je_shader.h (renamed from src/libjin/Graphics/Shader/Shader.h) | 13 | ||||
-rw-r--r-- | src/libjin/Graphics/Shader/je_texture.shader.h (renamed from src/libjin/Graphics/Shader/texture.shader.h) | 0 | ||||
-rw-r--r-- | src/libjin/Graphics/Window.h | 56 | ||||
-rw-r--r-- | src/libjin/Graphics/je_bitmap.cpp (renamed from src/libjin/Graphics/Bitmap.cpp) | 5 | ||||
-rw-r--r-- | src/libjin/Graphics/je_bitmap.h (renamed from src/libjin/Graphics/Bitmap.h) | 6 | ||||
-rw-r--r-- | src/libjin/Graphics/je_canvas.cpp (renamed from src/libjin/Graphics/Canvas.cpp) | 8 | ||||
-rw-r--r-- | src/libjin/Graphics/je_canvas.h (renamed from src/libjin/Graphics/Canvas.h) | 4 | ||||
-rw-r--r-- | src/libjin/Graphics/je_color.cpp (renamed from src/libjin/Graphics/Color.cpp) | 2 | ||||
-rw-r--r-- | src/libjin/Graphics/je_color.h (renamed from src/libjin/Graphics/Color.h) | 4 | ||||
-rw-r--r-- | src/libjin/Graphics/je_drawable.cpp (renamed from src/libjin/Graphics/Drawable.cpp) | 10 | ||||
-rw-r--r-- | src/libjin/Graphics/je_drawable.h (renamed from src/libjin/Graphics/Drawable.h) | 11 | ||||
-rw-r--r-- | src/libjin/Graphics/je_gl.cpp (renamed from src/libjin/Graphics/OpenGL.cpp) | 2 | ||||
-rw-r--r-- | src/libjin/Graphics/je_gl.h (renamed from src/libjin/Graphics/OpenGL.h) | 3 | ||||
-rw-r--r-- | src/libjin/Graphics/je_graphics.h | 21 | ||||
-rw-r--r-- | src/libjin/Graphics/je_image.cpp (renamed from src/libjin/Graphics/Image.cpp) | 5 | ||||
-rw-r--r-- | src/libjin/Graphics/je_image.h (renamed from src/libjin/Graphics/Image.h) | 2 | ||||
-rw-r--r-- | src/libjin/Graphics/je_mesh.cpp (renamed from src/libjin/Graphics/Mesh.cpp) | 2 | ||||
-rw-r--r-- | src/libjin/Graphics/je_mesh.h (renamed from src/libjin/Graphics/Mesh.h) | 0 | ||||
-rw-r--r-- | src/libjin/Graphics/je_shapes.cpp (renamed from src/libjin/Graphics/Shapes.cpp) | 12 | ||||
-rw-r--r-- | src/libjin/Graphics/je_shapes.h (renamed from src/libjin/Graphics/Shapes.h) | 8 | ||||
-rw-r--r-- | src/libjin/Graphics/je_sprite.cpp (renamed from src/libjin/Graphics/Sprite.cpp) | 0 | ||||
-rw-r--r-- | src/libjin/Graphics/je_sprite.h (renamed from src/libjin/Graphics/Sprite.h) | 0 | ||||
-rw-r--r-- | src/libjin/Graphics/je_texture.cpp (renamed from src/libjin/Graphics/Texture.cpp) | 10 | ||||
-rw-r--r-- | src/libjin/Graphics/je_texture.h (renamed from src/libjin/Graphics/Texture.h) | 10 | ||||
-rw-r--r-- | src/libjin/Graphics/je_window.cpp (renamed from src/libjin/Graphics/Window.cpp) | 18 | ||||
-rw-r--r-- | src/libjin/Graphics/je_window.h | 96 |
43 files changed, 394 insertions, 260 deletions
diff --git a/src/libjin/Graphics/Font/Decoder.h b/src/libjin/Graphics/Font/Decoder.h deleted file mode 100644 index 533f60b..0000000 --- a/src/libjin/Graphics/Font/Decoder.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __LIBJIN_UTF8_H -#define __LIBJIN_UTF8_H - -#include <vector> - -#include "Text.h" - -namespace jin -{ - namespace graphics - { - - class Decoder - { - public: - virtual const void* decode(const void* data, Codepoint* c) const = 0 ; - virtual const void* next(const void* data) const = 0; - }; - - class Utf8 : public Decoder - { - public: - const void* decode(const void* data, Codepoint* c) const override; - const void* next(const void* data) const override; - }; - /* - class Utf16 : public Decoder - { - public: - const void* decode(const void* data, Codepoint* c) const override; - const void* next(const void* data) const override; - }; - */ - class Ascii : public Decoder - { - public: - const void* decode(const void* data, Codepoint* c) const override; - const void* next(const void* data) const override; - }; - - } // namespace graphics -} // namespace jin - -#endif
\ No newline at end of file diff --git a/src/libjin/Graphics/Font/Page.h b/src/libjin/Graphics/Font/Page.h deleted file mode 100644 index e1430e1..0000000 --- a/src/libjin/Graphics/Font/Page.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __LIBJIN_PAGE_H -#define __LIBJIN_PAGE_H -#include "../../math/Vector2.hpp" -#include "Font.h" - -namespace jin -{ - namespace graphics - { - - class Font; - - struct GlyphVertex - { - int x, y; // screen coordinates - float u, v; // texture uv - }; - - struct GlyphArrayDrawInfo - { - GLuint texture; // atlas - unsigned int start; // glyph vertex indecies - unsigned int count; // glyph vertex count - }; - - /* for reduce draw call */ - struct Page - { - Font* font; - std::vector<GlyphArrayDrawInfo> glyphinfolist; - std::vector<GlyphVertex> glyphvertices; - math::Vector2<int> size; - }; - - } -} - -#endif
\ No newline at end of file diff --git a/src/libjin/Graphics/Font/Decoder.cpp b/src/libjin/Graphics/Font/je_decoder.cpp index 362fd2a..20695e7 100644 --- a/src/libjin/Graphics/Font/Decoder.cpp +++ b/src/libjin/Graphics/Font/je_decoder.cpp @@ -1,6 +1,6 @@ #include <stdlib.h> #include <string.h> -#include "Decoder.h" +#include "je_decoder.h" namespace jin { diff --git a/src/libjin/Graphics/Font/je_decoder.h b/src/libjin/Graphics/Font/je_decoder.h new file mode 100644 index 0000000..e95f7c3 --- /dev/null +++ b/src/libjin/Graphics/Font/je_decoder.h @@ -0,0 +1,88 @@ +#ifndef __LIBJIN_UTF8_H +#define __LIBJIN_UTF8_H + +#include <vector> + +#include "je_text.h" + +namespace jin +{ + namespace graphics + { + + /// + /// Text decoder. + /// + class Decoder + { + public: + /// + /// Decode a code unit. + /// + /// @param data Code units. + /// @param codepoint Value of code point. + /// @return Next code unit location. + /// + virtual const void* decode(const void* data, Codepoint* codepoint) const = 0 ; + + /// + /// Get next code unit location. + /// + /// @param data Code units. + /// @return Next code unit location. + /// + virtual const void* next(const void* data) const = 0; + }; + + /// + /// Utf-8 decoder. + /// + class Utf8 : public Decoder + { + public: + /// + /// Decode a code unit. + /// + /// @param data Code units. + /// @param codepoint Value of code point. + /// @return Next code unit location. + /// + const void* decode(const void* data, Codepoint* codepoint) const override; + + /// + /// Get next code unit location. + /// + /// @param data Code units. + /// @return Next code unit location. + /// + const void* next(const void* data) const override; + }; + + /// + /// Ascii decoder. + /// + class Ascii : public Decoder + { + public: + /// + /// Decode a code unit. + /// + /// @param data Code units. + /// @param codepoint Value of code point. + /// @return Next code unit location. + /// + const void* decode(const void* data, Codepoint* codepoint) const override; + + /// + /// Get next code unit location. + /// + /// @param data Code units. + /// @return Next code unit location. + /// + const void* next(const void* data) const override; + }; + + } // namespace graphics +} // namespace jin + +#endif
\ No newline at end of file diff --git a/src/libjin/Graphics/Font/Font.h b/src/libjin/Graphics/Font/je_font.h index 1d09cfc..9fde723 100644 --- a/src/libjin/Graphics/Font/Font.h +++ b/src/libjin/Graphics/Font/je_font.h @@ -1,7 +1,8 @@ #ifndef __LIBJIN_FONT_H #define __LIBJIN_FONT_H + #include <vector> -#include "Text.h" +#include "je_text.h" namespace jin { @@ -10,6 +11,9 @@ namespace jin struct Page; + /// + /// Base Font class. + /// class Font { public: diff --git a/src/libjin/Graphics/Font/je_page.h b/src/libjin/Graphics/Font/je_page.h new file mode 100644 index 0000000..d887c9b --- /dev/null +++ b/src/libjin/Graphics/Font/je_page.h @@ -0,0 +1,51 @@ +#ifndef __LIBJIN_PAGE_H +#define __LIBJIN_PAGE_H + +#include "../../math/je_vector2.hpp" + +#include "je_font.h" + +namespace jin +{ + namespace graphics + { + + class Font; + + /// + /// Glyphs data to be rendered. + /// + struct GlyphVertex + { + int x, y; ///< screen coordinates + float u, v; ///< normalized texture uv + }; + + /// + /// Glyphs info for reducing draw call. + /// + struct GlyphArrayDrawInfo + { + GLuint texture; ///< atlas + unsigned int start; ///< glyph vertex indecies + unsigned int count; ///< glyph vertex count + }; + + /// + /// Page to be rendered. + /// + /// A page is a pre-rendered text struct for reducing draw call. Each page + /// keeps a font pointer which should not be changed. + /// + struct Page + { + Font* font; + std::vector<GlyphArrayDrawInfo> glyphinfolist; + std::vector<GlyphVertex> glyphvertices; + math::Vector2<int> size; + }; + + } // namespace graphics +} // namespace jin + +#endif
\ No newline at end of file diff --git a/src/libjin/Graphics/Font/Text.cpp b/src/libjin/Graphics/Font/je_text.cpp index f2231f8..aa5cbda 100644 --- a/src/libjin/Graphics/Font/Text.cpp +++ b/src/libjin/Graphics/Font/je_text.cpp @@ -1,7 +1,7 @@ #include <cstring> -#include "Text.h" -#include "Decoder.h" +#include "je_text.h" +#include "je_decoder.h" namespace jin { diff --git a/src/libjin/Graphics/Font/Text.h b/src/libjin/Graphics/Font/je_text.h index 7256a52..38e60ca 100644 --- a/src/libjin/Graphics/Font/Text.h +++ b/src/libjin/Graphics/Font/je_text.h @@ -13,17 +13,22 @@ namespace jin typedef std::vector<Codepoint> Content; class Text; + class Decoder; + /// + /// Supported text encoding. + /// enum Encode { - UTF8, // utf-8 - //UTF16, // utf-16 - ASCII, // ASCII + UTF8, ///< utf-8 + ASCII, ///< ASCII }; - /* raw encoded text */ - class Text + /// + /// Decoded text. Saved as unicode codepoints. + /// + class Text { public: Text(Encode encode, const void* data); diff --git a/src/libjin/Graphics/Font/TextureFont.cpp b/src/libjin/Graphics/Font/je_texture_font.cpp index 4f6f5d6..3df77e5 100644 --- a/src/libjin/Graphics/Font/TextureFont.cpp +++ b/src/libjin/Graphics/Font/je_texture_font.cpp @@ -1,8 +1,10 @@ #include <vector> -#include "../../Math/Vector2.hpp" -#include "../Shader/Shader.h" -#include "TextureFont.h" +#include "../../math/je_vector2.hpp" + +#include "../shader/je_shader.h" + +#include "je_texture_font.h" namespace jin { diff --git a/src/libjin/Graphics/Font/TextureFont.h b/src/libjin/Graphics/Font/je_texture_font.h index a1d1a37..fa3f72e 100644 --- a/src/libjin/Graphics/Font/TextureFont.h +++ b/src/libjin/Graphics/Font/je_texture_font.h @@ -4,20 +4,23 @@ #include <map> #include <vector> -#include "../../Math/Vector4.hpp" -#include "../Drawable.h" -#include "../Bitmap.h" +#include "../../math/je_vector4.hpp" -#include "Page.h" -#include "Font.h" -#include "Text.h" +#include "../je_drawable.h" +#include "../je_bitmap.h" + +#include "je_page.h" +#include "je_font.h" +#include "je_text.h" namespace jin { namespace graphics { - - /* Texture font */ + + /// + /// + /// class TextureFont : public Font , public Drawable { @@ -56,7 +59,7 @@ namespace jin }; - } -} + } // namespace graphics +} // namespace jin #endif
\ No newline at end of file diff --git a/src/libjin/Graphics/Font/TTF.cpp b/src/libjin/Graphics/Font/je_ttf.cpp index fe47630..d44b2c7 100644 --- a/src/libjin/Graphics/Font/TTF.cpp +++ b/src/libjin/Graphics/Font/je_ttf.cpp @@ -1,14 +1,16 @@ -#include "../../configuration.h" +#include "../../core/je_configuration.h" #if LIBJIN_MODULES_RENDER #include <stdio.h> -#include "../../Common/Array.hpp" -#include "../OpenGL.h" -#include "../Color.h" -#include "../Shader/Shader.h" -#include "TTF.h" -#include "Page.h" +#include "../../common/je_array.hpp" + +#include "../je_gl.h" +#include "../je_color.h" +#include "../shader/je_shader.h" + +#include "je_ttf.h" +#include "je_page.h" #define STB_TRUETYPE_IMPLEMENTATION #include "../../3rdparty/stb/stb_truetype.h" @@ -142,7 +144,7 @@ namespace jin // TTF ///////////////////////////////////////////////////////////////////////////// - #include "../Shader/font.shader.h" + #include "../shader/je_font.shader.h" using namespace std; using namespace jin::math; diff --git a/src/libjin/Graphics/Font/TTF.h b/src/libjin/Graphics/Font/je_ttf.h index 88ddfd6..f3761ac 100644 --- a/src/libjin/Graphics/Font/TTF.h +++ b/src/libjin/Graphics/Font/je_ttf.h @@ -1,19 +1,20 @@ #ifndef __LIBJINTTF_H #define __LIBJIN_TTF_H -#include "../../configuration.h" +#include "../../core/je_configuration.h" #if LIBJIN_MODULES_RENDER #include <vector> #include <map> #include "../../3rdparty/stb/stb_truetype.h" -#include "../../math/quad.h" -#include "../Color.h" -#include "../drawable.h" +#include "../../math/je_quad.h" -#include "Page.h" -#include "Font.h" -#include "Text.h" +#include "../je_color.h" +#include "../je_drawable.h" + +#include "je_page.h" +#include "je_font.h" +#include "je_text.h" namespace jin { @@ -129,4 +130,5 @@ namespace jin } // namespace jin #endif // LIBJIN_MODULES_RENDER + #endif // __LIBJIN_FONT_H
\ No newline at end of file diff --git a/src/libjin/Graphics/Graphics.h b/src/libjin/Graphics/Graphics.h deleted file mode 100644 index 68579e5..0000000 --- a/src/libjin/Graphics/Graphics.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __LIBJIN_GRAPHICS_H -#define __LIBJIN_GRAPHICS_H -#include "../configuration.h" -#if LIBJIN_MODULES_RENDER - -#include "canvas.h" -#include "color.h" -#include "Shapes.h" -#include "texture.h" -#include "window.h" -#include "Bitmap.h" -#include "Image.h" - -#include "./Shader/Shader.h" - -#include "./Font/TTF.h" -#include "./Font/Text.h" -#include "./Font/TextureFont.h" - -#endif // LIBJIN_MODULES_RENDER -#endif // __LIBJIN_GRAPHICS_H
\ No newline at end of file diff --git a/src/libjin/Graphics/Shader/base.shader.h b/src/libjin/Graphics/Shader/je_base.shader.h index 45b63cd..45b63cd 100644 --- a/src/libjin/Graphics/Shader/base.shader.h +++ b/src/libjin/Graphics/Shader/je_base.shader.h diff --git a/src/libjin/Graphics/Shader/default.shader.h b/src/libjin/Graphics/Shader/je_default.shader.h index f0175d7..f0175d7 100644 --- a/src/libjin/Graphics/Shader/default.shader.h +++ b/src/libjin/Graphics/Shader/je_default.shader.h diff --git a/src/libjin/Graphics/Shader/font.shader.h b/src/libjin/Graphics/Shader/je_font.shader.h index e04c225..e04c225 100644 --- a/src/libjin/Graphics/Shader/font.shader.h +++ b/src/libjin/Graphics/Shader/je_font.shader.h diff --git a/src/libjin/Graphics/Shader/Shader.cpp b/src/libjin/Graphics/Shader/je_shader.cpp index a075d7d..686f2b9 100644 --- a/src/libjin/Graphics/Shader/Shader.cpp +++ b/src/libjin/Graphics/Shader/je_shader.cpp @@ -1,12 +1,14 @@ #include <regex> -#include "../../configuration.h" +#include "../../core/je_configuration.h" #if defined(jin_graphics_shader) #include <iostream> -#include "../../Filesystem/Buffer.h" -#include "../../utils/macros.h" -#include "Shader.h" +#include "../../filesystem/je_buffer.h" +#include "../../utils/je_macros.h" + +#include "je_shader.h" + namespace jin { namespace graphics @@ -21,7 +23,7 @@ namespace jin // SHADER_FORMAT_SIZE // formatShader // - #include "default.shader.h" + #include "je_default.shader.h" // // https://stackoverflow.com/questions/27941496/use-sampler-without-passing-through-value diff --git a/src/libjin/Graphics/Shader/Shader.h b/src/libjin/Graphics/Shader/je_shader.h index 71579a9..bcee584 100644 --- a/src/libjin/Graphics/Shader/Shader.h +++ b/src/libjin/Graphics/Shader/je_shader.h @@ -1,22 +1,25 @@ #ifndef __LIBJIN_SHADER_H #define __LIBJIN_SHADER_H -#include "../../configuration.h" +#include "../../core/je_configuration.h" #if defined(jin_graphics) && defined(jin_graphics_shader) #include <string> #include <map> #include "../../3rdparty/GLee/GLee.h" -#include "../color.h" -#include "../texture.h" -#include "../canvas.h" -#include "base.shader.h" + +#include "../je_color.h" +#include "../je_texture.h" +#include "../je_canvas.h" + +#include "je_base.shader.h" namespace jin { namespace graphics { + /// /// Built in shader program. /// diff --git a/src/libjin/Graphics/Shader/texture.shader.h b/src/libjin/Graphics/Shader/je_texture.shader.h index d1fc86f..d1fc86f 100644 --- a/src/libjin/Graphics/Shader/texture.shader.h +++ b/src/libjin/Graphics/Shader/je_texture.shader.h diff --git a/src/libjin/Graphics/Window.h b/src/libjin/Graphics/Window.h deleted file mode 100644 index 8d6c4f5..0000000 --- a/src/libjin/Graphics/Window.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef __LIBJIN_RENDER_WINDOW -#define __LIBJIN_RENDER_WINDOW -#include "../configuration.h" -#if LIBJIN_MODULES_RENDER - -#include "SDL2/SDL.h" -#include "../utils/utils.h" -#include "../math/Vector2.hpp" -#include "../common/Subsystem.hpp" - -namespace jin -{ - namespace graphics - { - - class Window : public Subsystem<Window> - { - public: - struct Setting : SettingBase - { - public: - const char* title; // - bool fullscreen; // ȫ - int width, height; // ڴС - bool vsync; // ֱͬ - int fps; // FPS - bool resizable; // resize - }; - - void setTitle(const char* title); - inline int getW(){ return size.w; } - inline int getH(){ return size.h; } - inline int getFPS(){ return fps; } - void swapBuffers(); - - private: - // declare a singleton - singleton(Window); - - Window() {}; - - virtual ~Window() {}; - bool initSystem(const SettingBase* setting) override; - void quitSystem() override; - - SDL_Window* wnd; - jin::math::Vector2<unsigned int> size; - int fps; - - }; - - } // namespace graphics -} // namespace jin - -#endif // LIBJIN_MODULES_RENDER -#endif // __LIBJIN_RENDER_WINDOW
\ No newline at end of file diff --git a/src/libjin/Graphics/Bitmap.cpp b/src/libjin/Graphics/je_bitmap.cpp index 8769e8f..2a619ac 100644 --- a/src/libjin/Graphics/Bitmap.cpp +++ b/src/libjin/Graphics/je_bitmap.cpp @@ -1,7 +1,8 @@ -#include "Bitmap.h" #define STB_IMAGE_IMPLEMENTATION #include "../3rdparty/stb/stb_image.h" -#include "../Math/math.h" +#include "../math/je_math.h" + +#include "je_bitmap.h" using namespace jin::math; diff --git a/src/libjin/Graphics/Bitmap.h b/src/libjin/Graphics/je_bitmap.h index 4341256..b9747f2 100644 --- a/src/libjin/Graphics/Bitmap.h +++ b/src/libjin/Graphics/je_bitmap.h @@ -1,11 +1,11 @@ #ifndef __LIBJIN_BITMAP_H #define __LIBJIN_BITMAP_H -#include "../configuration.h" +#include "../core/je_configuration.h" #if LIBJIN_MODULES_RENDER -#include "../Math/Vector2.hpp" #include "../3rdparty/GLee/GLee.h" -#include "Color.h" +#include "../math/je_vector2.hpp" +#include "je_color.h" namespace jin { diff --git a/src/libjin/Graphics/Canvas.cpp b/src/libjin/Graphics/je_canvas.cpp index f222721..af9868b 100644 --- a/src/libjin/Graphics/Canvas.cpp +++ b/src/libjin/Graphics/je_canvas.cpp @@ -1,9 +1,9 @@ -#include "../configuration.h" +#include "../core/je_configuration.h" #if LIBJIN_MODULES_RENDER -#include "../utils/macros.h" -#include "canvas.h" -#include "window.h" +#include "../utils/je_macros.h" +#include "je_canvas.h" +#include "je_window.h" namespace jin { diff --git a/src/libjin/Graphics/Canvas.h b/src/libjin/Graphics/je_canvas.h index 53070bf..12611d9 100644 --- a/src/libjin/Graphics/Canvas.h +++ b/src/libjin/Graphics/je_canvas.h @@ -1,9 +1,9 @@ #ifndef __LIBJIN_CANVAS_H #define __LIBJIN_CANVAS_H -#include "../configuration.h" +#include "../core/je_configuration.h" #if LIBJIN_MODULES_RENDER -#include "drawable.h" +#include "je_drawable.h" namespace jin { namespace graphics diff --git a/src/libjin/Graphics/Color.cpp b/src/libjin/Graphics/je_color.cpp index 517af50..821f19e 100644 --- a/src/libjin/Graphics/Color.cpp +++ b/src/libjin/Graphics/je_color.cpp @@ -1,4 +1,4 @@ -#include "Color.h" +#include "je_color.h" namespace jin { diff --git a/src/libjin/Graphics/Color.h b/src/libjin/Graphics/je_color.h index 2a6feca..b13d882 100644 --- a/src/libjin/Graphics/Color.h +++ b/src/libjin/Graphics/je_color.h @@ -3,10 +3,10 @@ */ #ifndef __LIBJIN_COLOR_H #define __LIBJIN_COLOR_H -#include "../configuration.h" +#include "../core/je_configuration.h" #if LIBJIN_MODULES_RENDER -#include "../utils/endian.h" +#include "../utils/je_endian.h" namespace jin { diff --git a/src/libjin/Graphics/Drawable.cpp b/src/libjin/Graphics/je_drawable.cpp index f819c9c..9b5746a 100644 --- a/src/libjin/Graphics/Drawable.cpp +++ b/src/libjin/Graphics/je_drawable.cpp @@ -1,11 +1,13 @@ -#include "../configuration.h" +#include "../core/je_configuration.h" #if LIBJIN_MODULES_RENDER -#include "./Shader/Shader.h" -#include "drawable.h" -#include "../math/matrix.h" #include <stdlib.h> +#include "../math/je_matrix.h" + +#include "shader/je_shader.h" +#include "je_drawable.h" + namespace jin { namespace graphics diff --git a/src/libjin/Graphics/Drawable.h b/src/libjin/Graphics/je_drawable.h index 007a9a1..13464f0 100644 --- a/src/libjin/Graphics/Drawable.h +++ b/src/libjin/Graphics/je_drawable.h @@ -1,12 +1,13 @@ #ifndef __LIBJIN_DRAWABLE #define __LIBJIN_DRAWABLE -#include "../configuration.h" +#include "../core/je_configuration.h" #if LIBJIN_MODULES_RENDER -#include "../math/Quad.h" -#include "../math/Vector2.hpp" -#include "OpenGL.h" -#include "Bitmap.h" +#include "../math/je_quad.h" +#include "../math/je_vector2.hpp" + +#include "je_gl.h" +#include "je_bitmap.h" namespace jin { diff --git a/src/libjin/Graphics/OpenGL.cpp b/src/libjin/Graphics/je_gl.cpp index 6bc176e..d228bb5 100644 --- a/src/libjin/Graphics/OpenGL.cpp +++ b/src/libjin/Graphics/je_gl.cpp @@ -1,5 +1,5 @@ #define OGL2D_IMPLEMENT -#include "OpenGL.h" +#include "je_gl.h" namespace jin { diff --git a/src/libjin/Graphics/OpenGL.h b/src/libjin/Graphics/je_gl.h index 47011a2..296b8aa 100644 --- a/src/libjin/Graphics/OpenGL.h +++ b/src/libjin/Graphics/je_gl.h @@ -1,8 +1,9 @@ #ifndef __LIBJIN_OPENGL_H #define __LIBJIN_OPENGL_H + #include "../3rdparty/GLee/GLee.h" #include "../3rdparty/ogl/OpenGL.h" -#include "../Math/Matrix.h" +#include "../math/je_matrix.h" namespace jin { diff --git a/src/libjin/Graphics/je_graphics.h b/src/libjin/Graphics/je_graphics.h new file mode 100644 index 0000000..6f099cd --- /dev/null +++ b/src/libjin/Graphics/je_graphics.h @@ -0,0 +1,21 @@ +#ifndef __LIBJIN_GRAPHICS_H +#define __LIBJIN_GRAPHICS_H +#include "../core/je_configuration.h" +#if LIBJIN_MODULES_RENDER + +#include "je_canvas.h" +#include "je_color.h" +#include "je_shapes.h" +#include "je_texture.h" +#include "je_window.h" +#include "je_bitmap.h" +#include "je_image.h" + +#include "shader/je_shader.h" + +#include "font/je_ttf.h" +#include "font/je_text.h" +#include "font/je_texture_font.h" + +#endif // LIBJIN_MODULES_RENDER +#endif // __LIBJIN_GRAPHICS_H
\ No newline at end of file diff --git a/src/libjin/Graphics/Image.cpp b/src/libjin/Graphics/je_image.cpp index 358a144..cca78a3 100644 --- a/src/libjin/Graphics/Image.cpp +++ b/src/libjin/Graphics/je_image.cpp @@ -1,6 +1,7 @@ #include "../3rdparty/stb/stb_image.h" -#include "../Filesystem/Filesystem.h" -#include "Image.h" +#include "../filesystem/je_filesystem.h" + +#include "je_image.h" namespace jin { diff --git a/src/libjin/Graphics/Image.h b/src/libjin/Graphics/je_image.h index 55798be..5c06258 100644 --- a/src/libjin/Graphics/Image.h +++ b/src/libjin/Graphics/je_image.h @@ -1,7 +1,7 @@ #ifndef __LIBJIN_IMAGE_H #define __LIBJIN_IMAGE_H -#include "Bitmap.h" +#include "je_bitmap.h" namespace jin { diff --git a/src/libjin/Graphics/Mesh.cpp b/src/libjin/Graphics/je_mesh.cpp index 3142894..1047e7e 100644 --- a/src/libjin/Graphics/Mesh.cpp +++ b/src/libjin/Graphics/je_mesh.cpp @@ -1,4 +1,4 @@ -#include "Mesh.h" +#include "je_mesh.h" namespace jin { diff --git a/src/libjin/Graphics/Mesh.h b/src/libjin/Graphics/je_mesh.h index 66727e4..66727e4 100644 --- a/src/libjin/Graphics/Mesh.h +++ b/src/libjin/Graphics/je_mesh.h diff --git a/src/libjin/Graphics/Shapes.cpp b/src/libjin/Graphics/je_shapes.cpp index 69eda70..31c793f 100644 --- a/src/libjin/Graphics/Shapes.cpp +++ b/src/libjin/Graphics/je_shapes.cpp @@ -1,12 +1,14 @@ -#include "../configuration.h" +#include "../core/je_configuration.h" #if LIBJIN_MODULES_RENDER -#include "./Shader/Shader.h" -#include "Shapes.h" -#include "../math/matrix.h" -#include "../math/constant.h" #include <string> +#include "../math/je_matrix.h" +#include "../math/je_constant.h" + +#include "shader/je_shader.h" +#include "je_shapes.h" + namespace jin { namespace graphics diff --git a/src/libjin/Graphics/Shapes.h b/src/libjin/Graphics/je_shapes.h index 07e7567..32b5284 100644 --- a/src/libjin/Graphics/Shapes.h +++ b/src/libjin/Graphics/je_shapes.h @@ -1,11 +1,11 @@ #ifndef __LIBJIN_GEOMETRY_H #define __LIBJIN_GEOMETRY_H -#include "../configuration.h" +#include "../core/je_configuration.h" #if LIBJIN_MODULES_RENDER -#include "color.h" -#include "canvas.h" -#include "texture.h" +#include "je_color.h" +#include "je_canvas.h" +#include "je_texture.h" namespace jin { diff --git a/src/libjin/Graphics/Sprite.cpp b/src/libjin/Graphics/je_sprite.cpp index e69de29..e69de29 100644 --- a/src/libjin/Graphics/Sprite.cpp +++ b/src/libjin/Graphics/je_sprite.cpp diff --git a/src/libjin/Graphics/Sprite.h b/src/libjin/Graphics/je_sprite.h index 7a4e53a..7a4e53a 100644 --- a/src/libjin/Graphics/Sprite.h +++ b/src/libjin/Graphics/je_sprite.h diff --git a/src/libjin/Graphics/Texture.cpp b/src/libjin/Graphics/je_texture.cpp index 226187d..d2e53e2 100644 --- a/src/libjin/Graphics/Texture.cpp +++ b/src/libjin/Graphics/je_texture.cpp @@ -1,10 +1,12 @@ -#include "../configuration.h" +#include "../core/je_configuration.h" #if LIBJIN_MODULES_RENDER #include <fstream> -#include "texture.h" -#include "../utils/utils.h" -#include "../Math/Math.h" + +#include "../utils/je_utils.h" +#include "../math/je_math.h" + +#include "je_texture.h" namespace jin { diff --git a/src/libjin/Graphics/Texture.h b/src/libjin/Graphics/je_texture.h index 3e0161c..30c5063 100644 --- a/src/libjin/Graphics/Texture.h +++ b/src/libjin/Graphics/je_texture.h @@ -1,12 +1,14 @@ #ifndef __LIBJIN_TEXTURE_H #define __LIBJIN_TEXTURE_H -#include "../configuration.h" +#include "../core/je_configuration.h" #if defined(jin_graphics) #include "../3rdparty/GLee/GLee.h" -#include "Color.h" -#include "Drawable.h" -#include "Bitmap.h" + +#include "je_color.h" +#include "je_drawable.h" +#include "je_bitmap.h" + namespace jin { namespace graphics diff --git a/src/libjin/Graphics/Window.cpp b/src/libjin/Graphics/je_window.cpp index 1fd1f90..680dd0e 100644 --- a/src/libjin/Graphics/Window.cpp +++ b/src/libjin/Graphics/je_window.cpp @@ -1,14 +1,16 @@ -#include "../configuration.h" +#include "../core/je_configuration.h" #if LIBJIN_MODULES_RENDER #include <iostream> -#include "window.h" -#include "OpenGL.h" -#include "canvas.h" -#include "./Shader/Shader.h" -#include "../utils/utils.h" -#include "../audio/sdl/SDLAudio.h" -#include "../utils/log.h" + +#include "../utils/je_utils.h" +#include "../audio/sdl/je_sdl_audio.h" +#include "../utils/je_log.h" + +#include "shader/je_shader.h" +#include "je_window.h" +#include "je_gl.h" +#include "je_canvas.h" namespace jin { diff --git a/src/libjin/Graphics/je_window.h b/src/libjin/Graphics/je_window.h new file mode 100644 index 0000000..995d8b0 --- /dev/null +++ b/src/libjin/Graphics/je_window.h @@ -0,0 +1,96 @@ +#ifndef __LIBJIN_RENDER_WINDOW +#define __LIBJIN_RENDER_WINDOW +#include "../core/je_configuration.h" +#if defined(jin_graphics) + +#include "SDL2/SDL.h" + +#include "../utils/je_utils.h" +#include "../math/je_vector2.hpp" +#include "../common/je_subsystem.hpp" + +namespace jin +{ + namespace graphics + { + /// + /// + /// + class Window : public Subsystem<Window> + { + public: + /// + /// + /// + struct Setting : SettingBase + { + public: + const char* title; ///< window title + bool fullscreen; ///< full screen + int width, height; ///< window size + bool vsync; ///< vsync + int fps; ///< frame per second + bool resizable; ///< resizable + }; + + /// + /// + /// + void setTitle(const char* title); + + /// + /// + /// + inline int getW(){ return size.w; } + + /// + /// + /// + inline int getH(){ return size.h; } + + /// + /// + /// + inline int getFPS(){ return fps; } + + /// + /// + /// + void swapBuffers(); + + private: + // declare a singleton + singleton(Window); + + /// + /// + /// + Window() {}; + + /// + /// + /// + virtual ~Window() {}; + + /// + /// + /// + bool initSystem(const SettingBase* setting) override; + + /// + /// + /// + void quitSystem() override; + + SDL_Window* wnd; + jin::math::Vector2<unsigned int> size; + int fps; + + }; + + } // namespace graphics +} // namespace jin + +#endif // jin_graphics + +#endif // __LIBJIN_RENDER_WINDOW
\ No newline at end of file |