new Tutorial
tutorial with sprite offset, sprite sheet and texture filtering
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
# _____ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licensed under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tyra>
|
||||
|
||||
namespace Tyra{
|
||||
|
||||
extern const int charSize;
|
||||
extern const int font_char[96];
|
||||
extern const int font_charWidth[96];
|
||||
|
||||
class Font{
|
||||
public:
|
||||
Font();
|
||||
void LoadFont(TextureRepository& repository, Renderer2D* renderer);
|
||||
void FreeFont(TextureRepository& repository);
|
||||
void DrawText(const char* text, int x, int y, Color color);
|
||||
void DrawText(const std::string& text, int x, int y, Color color);
|
||||
private:
|
||||
Renderer2D* renderer2D;
|
||||
Sprite all_font;
|
||||
std::array<Sprite,96> font;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -11,6 +11,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <tyra>
|
||||
#include "fontSprite.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
@@ -27,8 +28,16 @@ class Tutorial10 : public Game {
|
||||
void loadSprite();
|
||||
|
||||
Engine* engine;
|
||||
Pad* pad;
|
||||
Font font;
|
||||
|
||||
Sprite sprite;
|
||||
Sprite spriteFlip;
|
||||
Sprite spriteScale;
|
||||
Sprite spriteStrech;
|
||||
std::string str_filter;
|
||||
|
||||
PipelineTextureMappingType textureFilter;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
Reference in New Issue
Block a user