diff --git a/src/main.c3 b/src/main.c3 index b0176eb..7382ebc 100644 --- a/src/main.c3 +++ b/src/main.c3 @@ -130,7 +130,7 @@ fn int main(String[] args) defer ui.free(); ui.load_font("font1", "resources/hack-nerd.ttf", 16)!!; - ui.sprite_atlas_create("icons", AtlasType.ATLAS_RGBA32, 512, 512)!!; + ui.sprite_atlas_create("icons", AtlasType.ATLAS_R8G8B8A8, 512, 512)!!; ui.import_sprite_file_qoi("tux", "resources/tux.qoi")!!; ui.import_sprite_file_qoi("tick", "resources/tick_sdf.qoi", SpriteType.SPRITE_MSDF)!!; diff --git a/src/ugui_atlas.c3 b/src/ugui_atlas.c3 index 1976ec4..8745fd7 100644 --- a/src/ugui_atlas.c3 +++ b/src/ugui_atlas.c3 @@ -9,7 +9,7 @@ fault UgAtlasError { enum AtlasType { ATLAS_GRAYSCALE, - ATLAS_RGBA32, + ATLAS_R8G8B8A8, } // black and white atlas @@ -29,7 +29,7 @@ macro usz AtlasType.bpp(type) { switch (type) { case ATLAS_GRAYSCALE: return 1; - case ATLAS_RGBA32: return 4; + case ATLAS_R8G8B8A8: return 4; } } diff --git a/src/ugui_sprite.c3 b/src/ugui_sprite.c3 index 7c1d368..b4a83f2 100644 --- a/src/ugui_sprite.c3 +++ b/src/ugui_sprite.c3 @@ -36,13 +36,13 @@ struct ElemSprite { // name: some examples are "icons" or "images" fn void! SpriteAtlas.init(&this, String name, AtlasType type, ushort width, ushort height) { - // FIXME: for now only RGBA32 format is supported - if (type != ATLAS_RGBA32) { + // FIXME: for now only R8G8B8A8 format is supported + if (type != ATLAS_R8G8B8A8) { return UgAtlasError.INVALID_TYPE?; } this.id = name.hash(); - this.atlas.new(this.id, AtlasType.ATLAS_RGBA32, width, height)!; + this.atlas.new(this.id, AtlasType.ATLAS_R8G8B8A8, width, height)!; this.sprites.new_init(capacity: SRITES_PER_ATLAS); this.should_update = false; } @@ -54,6 +54,7 @@ fn void! SpriteAtlas.free(&this) } // FIXME: this should throw an error when a different pixel format than the atlas' is used +// or convert from the source's pixel format to the atlas' fn Sprite*! SpriteAtlas.insert(&this, String name, SpriteType type, char[] pixels, ushort w, ushort h, ushort stride) { Sprite s;