merge: merge changes from upstream master
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
# _____ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022-2023, tyra - https://github.com/h4570/tyra
|
||||
# Licensed under Apache License 2.0
|
||||
# Guido Diego Quispe Robles
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tyra>
|
||||
|
||||
#define FONT_CHAR_SIZE 96
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class Font {
|
||||
public:
|
||||
Font();
|
||||
void load(TextureRepository& repository, Renderer2D* renderer);
|
||||
void free(TextureRepository& repository);
|
||||
void drawText(const char* text, const int& x, const int& y, Color color);
|
||||
void drawText(const std::string& text, const int& x, const int& y,
|
||||
Color color);
|
||||
|
||||
private:
|
||||
const static int chars[FONT_CHAR_SIZE];
|
||||
const static int charWidths[FONT_CHAR_SIZE];
|
||||
|
||||
Renderer2D* renderer2D;
|
||||
Sprite allFont;
|
||||
std::array<Sprite, FONT_CHAR_SIZE> font;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
# _____ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022-2023, tyra - https://github.com/h4570/tyra
|
||||
# Licensed under Apache License 2.0
|
||||
# Guido Diego Quispe Robles
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tyra>
|
||||
#include "font_sprite.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class Tutorial10 : public Game {
|
||||
public:
|
||||
explicit Tutorial10(Engine* engine);
|
||||
~Tutorial10();
|
||||
|
||||
void init();
|
||||
void loop();
|
||||
|
||||
private:
|
||||
void loadTexture();
|
||||
void loadSprite();
|
||||
void handlePad();
|
||||
|
||||
int padTimer;
|
||||
Engine* engine;
|
||||
Pad* pad;
|
||||
Font font;
|
||||
|
||||
Sprite sprite;
|
||||
Sprite spriteFlip;
|
||||
Sprite spriteScale;
|
||||
Sprite spriteStretch;
|
||||
std::string strFilter;
|
||||
|
||||
PipelineTextureMappingType textureFilter;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
Reference in New Issue
Block a user