Added an enum for empty textures.

This commit is contained in:
Kapendev 2025-04-16 12:48:39 +03:00
parent cb0cb5a904
commit 58e94cdd56
3 changed files with 9 additions and 8 deletions

View file

@ -25,9 +25,10 @@ alias EngineUpdateFunc = bool function(float dt);
alias EngineReadyFinishFunc = void function();
alias EngineFlags = ushort;
enum defaultEngineTexturesCapacity = 64;
enum defaultEngineSoundsCapacity = 64;
enum defaultEngineFontsCapacity = 16;
enum defaultEngineTexturesCapacity = 128;
enum defaultEngineSoundsCapacity = 128;
enum defaultEngineFontsCapacity = 16;
enum defaultEngineEmptyTextureColor = white;
enum EngineFlag : EngineFlags {
none = 0x0000,
@ -2277,7 +2278,7 @@ extern(C)
void drawTextureAreaX(Texture texture, Rect area, Vec2 position, DrawOptions options = DrawOptions()) {
if (area.size.x <= 0.0f || area.size.y <= 0.0f) return;
if (texture.isEmpty) {
if (isEmptyTextureVisible) drawRect(Rect(position, area.size * options.scale).area(options.hook), red);
if (isEmptyTextureVisible) drawRect(Rect(position, area.size * options.scale).area(options.hook), defaultEngineEmptyTextureColor);
return;
}
auto target = Rect(position, area.size * options.scale.abs());
@ -2339,7 +2340,7 @@ void drawTexture(TextureId texture, Vec2 position, DrawOptions options = DrawOpt
extern(C)
void drawTexturePatchX(Texture texture, Rect area, Rect target, bool isTiled, DrawOptions options = DrawOptions()) {
if (texture.isEmpty) {
if (isEmptyTextureVisible) drawRect(target.area(options.hook), red);
if (isEmptyTextureVisible) drawRect(target.area(options.hook), defaultEngineEmptyTextureColor);
return;
}

View file

@ -317,7 +317,7 @@ Fault saveTileMap(IStr path, TileMap map) {
void drawTileX(Texture texture, Tile tile, DrawOptions options = DrawOptions()) {
if (tile.id < 0 || tile.width <= 0 || tile.height <= 0) return;
if (texture.isEmpty) {
if (isEmptyTextureVisible) drawRect(Rect(tile.position, tile.size * options.scale).area(options.hook), green);
if (isEmptyTextureVisible) drawRect(Rect(tile.position, tile.size * options.scale).area(options.hook), defaultEngineEmptyTextureColor);
return;
}
drawTextureAreaX(texture, tile.textureArea(texture.width / tile.width), tile.position, options);
@ -330,7 +330,7 @@ void drawTile(TextureId texture, Tile tile, DrawOptions options = DrawOptions())
void drawTileMapX(Texture texture, TileMap map, Camera camera, DrawOptions options = DrawOptions()) {
if (map.softRowCount == 0 || map.softColCount == 0 || map.tileWidth <= 0 || map.tileHeight <= 0) return;
if (texture.isEmpty) {
if (isEmptyTextureVisible) drawRect(Rect(map.position, map.size * options.scale).area(options.hook), red);
if (isEmptyTextureVisible) drawRect(Rect(map.position, map.size * options.scale).area(options.hook), defaultEngineEmptyTextureColor);
return;
}

View file

@ -148,7 +148,7 @@ struct Sprite {
void drawSpriteX(Texture texture, Sprite sprite, DrawOptions options = DrawOptions()) {
if (sprite.width == 0 || sprite.height == 0) return;
if (texture.isEmpty) {
if (isEmptyTextureVisible) drawRect(Rect(sprite.position, sprite.size * options.scale).area(options.hook), green);
if (isEmptyTextureVisible) drawRect(Rect(sprite.position, sprite.size * options.scale).area(options.hook), defaultEngineEmptyTextureColor);
return;
}