mirror of
https://github.com/Fluffy-Bean/ColouringApp.git
synced 2025-01-15 01:45:13 +00:00
sdafdasddasf
This commit is contained in:
parent
96ac8df1be
commit
9ed1e192d7
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -5,4 +5,10 @@
|
||||||
# Remove Enviroment Variables
|
# Remove Enviroment Variables
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
# Remove User Data
|
||||||
userData
|
userData
|
||||||
|
|
||||||
|
# Remove Compiled Files
|
||||||
|
ColouringApp
|
||||||
|
ColouringApp.exe
|
||||||
|
ColouringApp.zip
|
||||||
|
|
48
main.go
48
main.go
|
@ -48,16 +48,15 @@ func main() {
|
||||||
checkDirs() // Make sure all the directories exist
|
checkDirs() // Make sure all the directories exist
|
||||||
|
|
||||||
raylib.SetConfigFlags(raylib.FlagWindowResizable)
|
raylib.SetConfigFlags(raylib.FlagWindowResizable)
|
||||||
// raylib.SetTraceLogLevel(raylib.LogTrace)
|
//raylib.SetConfigFlags(raylib.FlagWindowHighdpi)
|
||||||
// raylib.SetConfigFlags(raylib.FlagMsaa4xHint)
|
// raylib.SetConfigFlags(raylib.FlagMsaa4xHint)
|
||||||
// raylib.SetConfigFlags(raylib.FlagVsyncHint)
|
|
||||||
// raylib.SetConfigFlags(raylib.FlagFullscreenMode)
|
|
||||||
|
|
||||||
raylib.InitWindow(WindowWidth, WindowHeight, WindowTitle)
|
raylib.InitWindow(WindowWidth, WindowHeight, WindowTitle)
|
||||||
raylib.SetWindowMinSize(int(WindowMinWidth), int(WindowMinHeight))
|
raylib.SetWindowMinSize(int(WindowMinWidth), int(WindowMinHeight))
|
||||||
raylib.SetTargetFPS(int32(raylib.GetMonitorRefreshRate(raylib.GetCurrentMonitor())))
|
raylib.SetTargetFPS(int32(raylib.GetMonitorRefreshRate(raylib.GetCurrentMonitor())))
|
||||||
// raylib.SetExitKey(0) // disable exit key
|
// raylib.SetExitKey(0) // disable exit key
|
||||||
|
|
||||||
|
// Augh
|
||||||
var (
|
var (
|
||||||
camera = raylib.NewCamera2D(raylib.NewVector2(0, 0), raylib.NewVector2(0, 0), 0, 1)
|
camera = raylib.NewCamera2D(raylib.NewVector2(0, 0), raylib.NewVector2(0, 0), 0, 1)
|
||||||
|
|
||||||
|
@ -80,6 +79,7 @@ func main() {
|
||||||
showDebugStats = false
|
showDebugStats = false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// New Canvas stuff
|
||||||
var (
|
var (
|
||||||
createNewCanvas = true
|
createNewCanvas = true
|
||||||
|
|
||||||
|
@ -95,6 +95,26 @@ func main() {
|
||||||
newCanvasBackgroundColor = raylib.White
|
newCanvasBackgroundColor = raylib.White
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var userDataProjects []string
|
||||||
|
{
|
||||||
|
f, err := os.Open(DirUserData)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
|
files, err := f.Readdir(-1)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, file := range files {
|
||||||
|
if file.Mode().IsRegular() {
|
||||||
|
userDataProjects = append(userDataProjects, file.Name())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// LOOP
|
// LOOP
|
||||||
for !appShouldQuit {
|
for !appShouldQuit {
|
||||||
appShouldQuit = raylib.WindowShouldClose()
|
appShouldQuit = raylib.WindowShouldClose()
|
||||||
|
@ -132,7 +152,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if raylib.IsMouseButtonDown(raylib.MouseLeftButton) && state == StateDrawing {
|
if raylib.IsMouseButtonDown(raylib.MouseLeftButton) && state == StateDrawing {
|
||||||
var safeZone float32 = 5
|
var safeZone float32 = 1
|
||||||
|
|
||||||
if len(currentStroke.Points) <= 1 {
|
if len(currentStroke.Points) <= 1 {
|
||||||
currentStroke.Points = append(currentStroke.Points, raylib.GetMousePosition())
|
currentStroke.Points = append(currentStroke.Points, raylib.GetMousePosition())
|
||||||
|
@ -198,7 +218,7 @@ func main() {
|
||||||
// UI stuff
|
// UI stuff
|
||||||
raylib.BeginScissorMode(sidePanelRelativeX, 0, int32(sidePanelWidth), WindowHeight)
|
raylib.BeginScissorMode(sidePanelRelativeX, 0, int32(sidePanelWidth), WindowHeight)
|
||||||
{
|
{
|
||||||
raylib.DrawRectangle(sidePanelRelativeX, 0, int32(sidePanelWidth), WindowHeight, raylib.Fade(raylib.White, 0.7))
|
raylib.DrawRectangle(sidePanelRelativeX, 0, int32(sidePanelWidth), WindowHeight, raylib.Fade(raylib.White, 0.9))
|
||||||
|
|
||||||
if gui.Button(raylib.NewRectangle(float32(sidePanelRelativeX+10), 10, 25, 25), gui.IconText(gui.ICON_FOLDER_OPEN, "")) {
|
if gui.Button(raylib.NewRectangle(float32(sidePanelRelativeX+10), 10, 25, 25), gui.IconText(gui.ICON_FOLDER_OPEN, "")) {
|
||||||
state = StateFileMenu
|
state = StateFileMenu
|
||||||
|
@ -313,7 +333,7 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gui.GroupBox(raylib.NewRectangle(windowPos.X+11, windowPos.Y+244, windowPos.Width-22, 40), "Open Existing")
|
gui.GroupBox(raylib.NewRectangle(windowPos.X+11, windowPos.Y+244, windowPos.Width-22, float32(len(userDataProjects)*20)+10), "Open Existing")
|
||||||
{
|
{
|
||||||
if gui.Button(raylib.NewRectangle(windowPos.X+21, windowPos.Y+254, windowPos.Width-42, 20), "Maned Wolf") {
|
if gui.Button(raylib.NewRectangle(windowPos.X+21, windowPos.Y+254, windowPos.Width-42, 20), "Maned Wolf") {
|
||||||
loadedImage := raylib.LoadImage(DirAssets + "manedWolf.jpg")
|
loadedImage := raylib.LoadImage(DirAssets + "manedWolf.jpg")
|
||||||
|
@ -328,6 +348,22 @@ func main() {
|
||||||
|
|
||||||
AddToast("Loaded Maned Wolf")
|
AddToast("Loaded Maned Wolf")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for i := 0; i < len(userDataProjects); i++ {
|
||||||
|
if gui.Button(raylib.NewRectangle(windowPos.X+21, windowPos.Y+274+float32(i*20), windowPos.Width-42, 20), userDataProjects[i]) {
|
||||||
|
loadedImage := raylib.LoadImage(DirUserData + userDataProjects[i])
|
||||||
|
{
|
||||||
|
raylib.ImageFlipHorizontal(loadedImage)
|
||||||
|
raylib.ImageRotate(loadedImage, 180)
|
||||||
|
}
|
||||||
|
canvas = NewCanvas("NewProject", raylib.NewVector2(float32(loadedImage.Width), float32(loadedImage.Height)), raylib.NewVector2(15, 15), raylib.LoadTextureFromImage(loadedImage))
|
||||||
|
|
||||||
|
raylib.UnloadImage(loadedImage)
|
||||||
|
state = StateNormal
|
||||||
|
|
||||||
|
AddToast("Loaded " + userDataProjects[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
raylib.EndScissorMode()
|
raylib.EndScissorMode()
|
||||||
|
|
Loading…
Reference in a new issue