Initial debug file.
Debug file will contain any debug functionality, ui, cameras, bounding boxes etc
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package game
|
||||
|
||||
import rl "vendor:raylib"
|
||||
|
||||
debug_init :: proc() {
|
||||
rl.TraceLog(.INFO, "Game initialized")
|
||||
}
|
||||
|
||||
debug_fps :: proc() {
|
||||
if !DEBUG_MODE do return
|
||||
rl.DrawFPS(20, 20)
|
||||
}
|
||||
|
||||
// DEBUG CAMERA
|
||||
debug_camera_init :: proc(player: Player) -> rl.Camera2D {
|
||||
offset_adjust := (TILE_SIZE / 2) * 0.3
|
||||
|
||||
return rl.Camera2D {
|
||||
target = player.pos,
|
||||
offset = rl.Vector2{ f32(GAME_WIDTH/2 - offset_adjust), f32(GAME_HEIGHT/2 - offset_adjust) },
|
||||
rotation = 0,
|
||||
zoom = 0.3
|
||||
}
|
||||
}
|
||||
|
||||
update_debug_camera :: proc(camera: ^rl.Camera2D) {
|
||||
if rl.IsKeyDown(.LEFT_CONTROL) {
|
||||
scroll := rl.GetMouseWheelMove()
|
||||
if scroll != 0.0 {
|
||||
camera.zoom += scroll * 0.1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user