diff --git a/application/globalVars.go b/application/globalVars.go index cc0df8c..1d7647f 100644 --- a/application/globalVars.go +++ b/application/globalVars.go @@ -1,24 +1,37 @@ package application const ( - WindowTitle = "Colouring App" + // WindowTitle used as the Windows Title but also used for the name of the game + WindowTitle = "Colouring App" + + // Defines the window proportions WindowWidth = 800 WindowHeight = 600 - WindowFPS = 60 + + // WindowFPS Max FPS the game should run at, used to calucalte delta time + WindowFPS = 60 ) +// Scene IDs used to determine which scene to run const ( ScenePlayerData = iota SceneTitle SceneOptions + SceneGallery + SceneDraw SceneGame ) +// Directories used to store assets const ( DirAssets = "./assets/" DirPlayerData = "./playerData/" ) -var CurrentScene = ScenePlayerData +var ( + // ShouldQuit is used to determine if the game should quit + ShouldQuit = false -var ShouldQuit = false + // CurrentScene is the scene that is currently running + CurrentScene = ScenePlayerData +) diff --git a/go.mod b/go.mod index 8e5ba81..47f4030 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module ColouringApp go 1.21.5 require ( - github.com/gen2brain/raylib-go/raygui v0.0.0-20231230150416-17ce08145200 - github.com/gen2brain/raylib-go/raylib v0.0.0-20231230150416-17ce08145200 + github.com/gen2brain/raylib-go/raygui v0.0.0-20240110102818-483e94e4d92e + github.com/gen2brain/raylib-go/raylib v0.0.0-20240110102818-483e94e4d92e ) require ( diff --git a/go.sum b/go.sum index 3126fe8..68b512b 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/ebitengine/purego v0.6.0-alpha.1.0.20231122024802-192c5e846faa h1:Ik7QikRgeH+bFOfAcMpttCbs6XxWXxCLXMm4awxtOXk= github.com/ebitengine/purego v0.6.0-alpha.1.0.20231122024802-192c5e846faa/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ= -github.com/gen2brain/raylib-go/raygui v0.0.0-20231230150416-17ce08145200 h1:8UJDYu3Ws+VRrPnhESvjtityUEotaFM2uEPbT+3rR8Q= -github.com/gen2brain/raylib-go/raygui v0.0.0-20231230150416-17ce08145200/go.mod h1:Ra1zgJP7vnGst+STvzPPiVJhjicklFWONCz5nu6MnOM= -github.com/gen2brain/raylib-go/raylib v0.0.0-20231230150416-17ce08145200 h1:cff+9Xad/S2SfPhUieMoyDlvJFnsxvwd6aWFfhbeOe4= -github.com/gen2brain/raylib-go/raylib v0.0.0-20231230150416-17ce08145200/go.mod h1:P/hDjVwz/9fhR0ww3+umzDpDA7Bf7Tce4xNChHIEFqE= +github.com/gen2brain/raylib-go/raygui v0.0.0-20240110102818-483e94e4d92e h1:rbZ3Fy7hRHL/GLcm9sCt3N2tjTPGT9EwGwvVHTuVnJQ= +github.com/gen2brain/raylib-go/raygui v0.0.0-20240110102818-483e94e4d92e/go.mod h1:Ra1zgJP7vnGst+STvzPPiVJhjicklFWONCz5nu6MnOM= +github.com/gen2brain/raylib-go/raylib v0.0.0-20240110102818-483e94e4d92e h1:t/kVA/quBlzLB+43QzIsHkFQrZs2ii79rk9NOofbQxs= +github.com/gen2brain/raylib-go/raylib v0.0.0-20240110102818-483e94e4d92e/go.mod h1:P/hDjVwz/9fhR0ww3+umzDpDA7Bf7Tce4xNChHIEFqE= golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= diff --git a/main.go b/main.go index 1bd73f3..37153f7 100644 --- a/main.go +++ b/main.go @@ -3,10 +3,13 @@ package main import ( "ColouringApp/application" "ColouringApp/scenes" + raylib "github.com/gen2brain/raylib-go/raylib" ) func main() { + //raylib.SetConfigFlags(raylib.FlagWindowResizable) + raylib.InitWindow(application.WindowWidth, application.WindowHeight, application.WindowTitle) raylib.InitAudioDevice() diff --git a/scenes/draw.go b/scenes/draw.go new file mode 100644 index 0000000..a58bd87 --- /dev/null +++ b/scenes/draw.go @@ -0,0 +1 @@ +package scenes diff --git a/scenes/gallery.go b/scenes/gallery.go new file mode 100644 index 0000000..e79e658 --- /dev/null +++ b/scenes/gallery.go @@ -0,0 +1,2 @@ +package scenes + diff --git a/scenes/title.go b/scenes/title.go index e137de8..8ec5865 100644 --- a/scenes/title.go +++ b/scenes/title.go @@ -25,18 +25,15 @@ func Title() { raylib.BeginDrawing() raylib.ClearBackground(raylib.Black) - raylib.DrawText(titleText, 10, 10, 20, raylib.White) - raylib.DrawLine(10, 40, 790, 40, raylib.White) - - if gui.Button(raylib.NewRectangle(10, 50, 100, 20), "Start") { - application.CurrentScene = application.SceneGame - } - if gui.Button(raylib.NewRectangle(10, 80, 100, 20), "Options") { - application.CurrentScene = application.SceneOptions - } - if gui.Button(raylib.NewRectangle(10, 110, 100, 20), "Quit") { + if gui.Button(raylib.NewRectangle(10, 10, 40, 40), gui.IconText(gui.ICON_CROSS, "")) { application.ShouldQuit = true } + raylib.DrawText(titleText, (application.WindowWidth-raylib.MeasureText(titleText, 20))/2, 20, 20, raylib.White) + if gui.Button(raylib.NewRectangle(application.WindowWidth-50, 10, 40, 40), gui.IconText(gui.ICON_GEAR, "")) { + application.CurrentScene = application.SceneOptions + } + + //raylib.DrawLine(10, 60, 790, 60, raylib.White) //// Map thing? //raylib.DrawRectangleLines(120, 39, application.WindowWidth-130, application.WindowHeight-49, raylib.White) @@ -44,6 +41,11 @@ func Title() { //raylib.DrawTexture(mapImage, int32(-mapX), int32(-mapY), raylib.White) raylib.EndScissorMode() + + if gui.Button(raylib.NewRectangle((application.WindowWidth-100)/2, application.WindowHeight-70, 100, 40), "Start") { + application.CurrentScene = application.SceneGame + } + raylib.EndDrawing() }