This commit is contained in:
Stefan Stefanov 2025-01-05 18:11:14 +02:00
parent 692c066a1a
commit cfcc5b9ade
10 changed files with 27 additions and 3 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 228 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 204 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

After

Width:  |  Height:  |  Size: 225 B

Before After
Before After

BIN
assets/seeds_ui_npatch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

BIN
assets/tool_ui_npatch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 431 B

After

Width:  |  Height:  |  Size: 235 B

Before After
Before After

BIN
game.rdi Normal file

Binary file not shown.

View file

@ -79,7 +79,16 @@ update_hotbar :: proc() {
}
draw_hotbar :: proc() {
rl.DrawRectangleRec({TOOL_POS.x, TOOL_POS.y, 32, 32}, rl.WHITE)
//rl.DrawRectangleRec({TOOL_POS.x, TOOL_POS.y, 32, 32}, rl.WHITE)
texture := hotbar.kind == .tools ? tool_ui_npatch_texture : seeds_ui_npatch_texture
rl.DrawTextureNPatch(
texture,
tool_ui_npatch,
{TOOL_POS.x, TOOL_POS.y, 32, 32},
{},
0,
rl.WHITE,
)
slots := hotbar.kind == .tools ? hotbar.tool_slots : hotbar.seed_slots
if len(slots) == 0 {return}
hotbar_item_texture := ITEM_TEXTURES[slots[hotbar.current_slot]]

View file

@ -10,6 +10,8 @@ tomato_spritesheet_sprite: []u8 : #load("../assets/tomato.png")
tomato_item_sprite: []u8 : #load("../assets/tomato_item.png")
sell_button_sprite: []u8 : #load("../assets/sell_button.png")
background_sprite: []u8 : #load("../assets/background.png")
tool_ui_npatch_sprite: []u8 : #load("../assets/tool_ui_npatch.png")
seeds_ui_npatch_sprite: []u8 : #load("../assets/seeds_ui_npatch.png")
tile_dirt_dry_sprite: []u8 : #load("../assets/tile_dirt_dry.png")
tile_dirt_wet_sprite: []u8 : #load("../assets/tile_dirt_wet.png")
hoe_sprite: []u8 : #load("../assets/hoe.png")
@ -21,6 +23,9 @@ pickup_sound: rl.Sound
sell_button_texture: rl.Texture2D
background_texture: rl.Texture2D
tool_ui_npatch_texture: rl.Texture2D
seeds_ui_npatch_texture: rl.Texture2D
tool_ui_npatch: rl.NPatchInfo
tile_dirt_dry_texture: rl.Texture2D
tile_dirt_wet_texture: rl.Texture2D
tomato_texture: rl.Texture2D
@ -76,9 +81,18 @@ load_resources :: proc() {
offset = {TILE_SIZE / 2, TILE_SIZE},
}
background_texture = load_texture_from_memory(background_sprite)
sell_button_texture = load_texture_from_memory(sell_button_sprite)
background_texture = load_texture_from_memory(background_sprite)
tool_ui_npatch_texture = load_texture_from_memory(tool_ui_npatch_sprite)
seeds_ui_npatch_texture = load_texture_from_memory(seeds_ui_npatch_sprite)
tool_ui_npatch = rl.NPatchInfo {
source = {0, 0, TILE_SIZE, TILE_SIZE},
left = 2,
top = 2,
right = 2,
bottom = 2,
layout = .NINE_PATCH,
}
tile_dirt_dry_texture = load_texture_from_memory(tile_dirt_dry_sprite)
tile_dirt_wet_texture = load_texture_from_memory(tile_dirt_wet_sprite)
@ -133,6 +147,7 @@ free_resources :: proc() {
rl.UnloadTexture(sell_button_texture)
rl.UnloadTexture(background_texture)
rl.UnloadTexture(tool_ui_npatch_texture)
rl.UnloadTexture(tomato_texture)
rl.UnloadTexture(tile_dirt_dry_texture)