diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..80067e1 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/cpp/NativeEngine.cpp b/app/src/main/cpp/NativeEngine.cpp index 8a1915d..60463fe 100644 --- a/app/src/main/cpp/NativeEngine.cpp +++ b/app/src/main/cpp/NativeEngine.cpp @@ -196,8 +196,6 @@ void NativeEngine::gameLoop() float x = 50; float y = 50; - float start_x = x; - float start_y = y; y += m_font.baseline_adjust; const char* text = "Hallo Welt"; for (const char* c = text; *c != '\0'; ++c) { @@ -211,12 +209,10 @@ void NativeEngine::gameLoop() Renderer::ptr->addFontRect( x, y, w, h, - 1.f, 1.f, 1.f, 1.f, 24.f, StringRepository::global->internString("Milky Honey.ttf"), quad.s0, quad.t0, quad.s1, quad.t1); - ALOGI("%f %f %f %f", quad.x0, quad.y0, quad.x1, quad.y1); } } // ENDE VOM BEISPIELCODE diff --git a/app/src/main/cpp/Renderer.cpp b/app/src/main/cpp/Renderer.cpp index 6841f2d..8247028 100644 --- a/app/src/main/cpp/Renderer.cpp +++ b/app/src/main/cpp/Renderer.cpp @@ -223,6 +223,20 @@ void Renderer::addRect(float x, m_draw_textures.push_back(texture); } +void Renderer::addFontRect(float x, + float y, + float w, + float h, + float char_height, + StringHandle font, + float src_x0, + float src_y0, + float src_x1, + float src_y1) +{ + addFontRect(x, y, w, h, 0.f, 0.f, 0.f, 1.f, char_height, font, src_x0, src_y0, src_x1, src_y1); +} + void Renderer::addFontRect(float x, float y, float w, diff --git a/app/src/main/cpp/Renderer.h b/app/src/main/cpp/Renderer.h index 54697a5..ee81378 100644 --- a/app/src/main/cpp/Renderer.h +++ b/app/src/main/cpp/Renderer.h @@ -114,6 +114,28 @@ public: float src_w, float src_h); + /// @brief Adds a font rectangle to the screen with black text + /// \param x X-coordinate of the top-left corner + /// \param y Y-coordinate of the top-left corner + /// \param w width in pixels + /// \param h height in pixels + /// \param char_height Height of characters in pixels + /// \param font String handle in the global string repository of the ttf file name + /// \param src_x0 bottom left corner of the source rectangle inside the texture [0, 1] + /// \param src_y0 bottom left corner of the source rectangle inside the texture [0, 1] + /// \param src_x1 top right of the source rectangle inside the texture [0, 1] + /// \param src_y1 top right of the source rectangle inside the texture [0, 1] + void addFontRect(float x, + float y, + float w, + float h, + float char_height, + StringHandle font, + float src_x0, + float src_y0, + float src_x1, + float src_y1); + /// @brief Adds a tinted font rectangle to the screen /// \param x X-coordinate of the top-left corner /// \param y Y-coordinate of the top-left corner @@ -125,10 +147,10 @@ public: /// \param a alpha [0,1] /// \param char_height Height of characters in pixels /// \param font String handle in the global string repository of the ttf file name - /// \param src_x top left corner of the source rectangle inside the texture [0, 1] - /// \param src_y top left corner of the source rectangle inside the texture [0, 1] - /// \param src_w width of the source rectangle inside the texture [0, 1] - /// \param src_h height of the source rectangle inside the texture [0, 1] + /// \param src_x0 bottom left corner of the source rectangle inside the texture [0, 1] + /// \param src_y0 bottom left corner of the source rectangle inside the texture [0, 1] + /// \param src_x1 top right of the source rectangle inside the texture [0, 1] + /// \param src_y1 top right of the source rectangle inside the texture [0, 1] void addFontRect(float x, float y, float w, @@ -139,10 +161,10 @@ public: float a, float char_height, StringHandle font, - float src_x, - float src_y, - float src_w, - float src_h); + float src_x0, + float src_y0, + float src_x1, + float src_y1); /// @brief Renders the frame ///