I actually just forgotten

This commit is contained in:
Michał 2024-01-11 00:17:29 +00:00
parent 1b05e0364b
commit 9225fd428a
6 changed files with 64 additions and 6 deletions

View file

@ -8,11 +8,17 @@ const (
)
const (
SceneTitle = iota
ScenePlayerData = iota
SceneTitle
SceneOptions
SceneGame
)
var CurrentScene = SceneTitle
const (
DirAssets = "./assets/"
DirPlayerData = "./playerData/"
)
var CurrentScene = ScenePlayerData
var ShouldQuit = false

BIN
assets/Map.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View file

@ -16,6 +16,8 @@ func main() {
// MAIN LOOP
for !application.ShouldQuit {
switch application.CurrentScene {
case application.ScenePlayerData:
scenes.PlayerData()
case application.SceneTitle:
scenes.Title()
case application.SceneOptions:

View file

@ -3,6 +3,7 @@ package scenes
import (
"ColouringApp/application"
"fmt"
gui "github.com/gen2brain/raylib-go/raygui"
raylib "github.com/gen2brain/raylib-go/raylib"
)

29
scenes/playerData.go Normal file
View file

@ -0,0 +1,29 @@
package scenes
import (
"ColouringApp/application"
"time"
raylib "github.com/gen2brain/raylib-go/raylib"
)
func PlayerData() {
// Load player data here
for !application.ShouldQuit {
application.ShouldQuit = raylib.WindowShouldClose()
if application.CurrentScene != application.ScenePlayerData {
break
}
raylib.BeginDrawing()
raylib.ClearBackground(raylib.Black)
raylib.DrawText("Loading...", 10, application.WindowHeight-30, 20, raylib.White)
raylib.EndDrawing()
// Just a placeholder
time.Sleep(1 * time.Second)
application.CurrentScene = application.SceneTitle
}
}

View file

@ -9,10 +9,12 @@ import (
func Title() {
var (
titleText = "Example Game"
)
titleText = application.WindowTitle
mapImage = raylib.LoadTexture(application.DirAssets + "Map.png")
// load resources here
mapX = 0
mapY = 0
)
for !application.ShouldQuit {
application.ShouldQuit = raylib.WindowShouldClose()
@ -36,8 +38,26 @@ func Title() {
application.ShouldQuit = true
}
// Map thing?
raylib.DrawRectangleLines(120, 39, application.WindowWidth-130, application.WindowHeight-49, raylib.White)
raylib.BeginScissorMode(121, 40, application.WindowWidth-132, application.WindowHeight-51)
mapX += 1
mapX = 0
mapY = 0
if mapX > 1920 {
mapX = 0
}
mapY += 1
if mapY > 1080 {
mapY = 0
}
raylib.DrawTexture(mapImage, int32(-mapX), int32(-mapY), raylib.White)
raylib.EndScissorMode()
raylib.EndDrawing()
}
// unload resources here
raylib.UnloadTexture(mapImage)
}