improve game icon

This commit is contained in:
Jeeves 2025-06-12 06:59:22 -06:00
parent f4fa4159c9
commit fe54b39afd
4 changed files with 10 additions and 10 deletions

View file

@ -21,8 +21,7 @@ pub fn main() !void {
defer crossmenu.deinit();
const game_column = try crossmenu.appendColumn(.{
.icon = raylib.LoadTexture("icon-mask.png"),
.normal = raylib.LoadTexture("icon-normal-2.png"),
.icon = raylib.LoadTexture("icon-normal-3.png"),
.title = "Game",
});
@ -273,18 +272,18 @@ pub const Column = struct {
pub const Options = struct {
icon: raylib.Texture2D,
normal: ?raylib.Texture2D = null,
title: []const u8,
};
pub fn init(allocator: Allocator, options: Options) Column {
raylib.SetTextureFilter(options.icon, raylib.TEXTURE_FILTER_BILINEAR);
raylib.SetTextureWrap(options.icon, raylib.TEXTURE_WRAP_CLAMP);
return .{
.items = .init(allocator),
.icon = .{
.texture = options.icon,
.normal = options.normal,
.is_normal_map = true,
},
.title = .{
.string = options.title,
@ -627,7 +626,8 @@ pub const BoundingBox = struct {
pub const Image = struct {
box: BoundingBox = undefined,
texture: raylib.Texture2D,
normal: ?raylib.Texture2D = null,
// normal: ?raylib.Texture2D = null,
is_normal_map: bool = false,
mode: Mode = .fit,
align_h: Align = .center,
@ -664,8 +664,7 @@ pub const Image = struct {
raylib.MAROON,
);
} else {
if (self.normal) |n| {
raylib.SetShaderValueTexture(icon_shader, raylib.GetShaderLocation(icon_shader, "textureNormal"), n);
if (self.is_normal_map) {
raylib.BeginShaderMode(icon_shader);
defer raylib.EndShaderMode();
raylib.DrawTextureEx(self.texture, position, 0, scale, raylib.WHITE);