This commit is contained in:
Michał 2024-01-15 12:19:49 +00:00
parent 2e2ae6b9a0
commit dc7506c947
7 changed files with 46 additions and 35 deletions

View file

@ -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
)

4
go.mod
View file

@ -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 (

8
go.sum
View file

@ -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=

View file

@ -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()

1
scenes/draw.go Normal file
View file

@ -0,0 +1 @@
package scenes

2
scenes/gallery.go Normal file
View file

@ -0,0 +1,2 @@
package scenes

View file

@ -22,40 +22,32 @@ func Title() {
break
}
// # Title #
// map
// # ### #
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)
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.BeginScissorMode(10, 60, application.WindowWidth-20, application.WindowHeight-70)
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()
}