summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhyscik <mynameisgennadiy@vk.com>2026-01-07 01:35:41 +0500
committerPhyscik <mynameisgennadiy@vk.com>2026-01-07 01:35:41 +0500
commit284b235a8f7672090bc4f31e56d451bb21d8ee55 (patch)
tree3ab29719b42c6efff775026d41c62ca9fb49b870
parentd804d0467399c821a05832a96ae4780ef69fb1bf (diff)
build system upgrades
-rw-r--r--.gitignore3
-rw-r--r--Makefile5
-rw-r--r--engine/Components/World.go (renamed from engine/GameObjects/World.go)16
-rw-r--r--engine/CoreObjects/GameObject.go (renamed from engine/CoreObjects/Object.go)2
-rw-r--r--engine/Settings/Flags.go11
-rw-r--r--engine/main.go4
6 files changed, 28 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..65e2a0a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+# build result
+RuinesOfRafdolon
+Config.json
diff --git a/Makefile b/Makefile
index 6ac3d68..e3a4ceb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,2 +1,7 @@
+all:
+ cd engine; go build .
+ ln -f engine/Config.json .
+ ln -f engine/RuinesOfRafdolon .
+
run:
cd engine; go run .
diff --git a/engine/GameObjects/World.go b/engine/Components/World.go
index 9ce16b0..015805d 100644
--- a/engine/GameObjects/World.go
+++ b/engine/Components/World.go
@@ -1,4 +1,4 @@
-package gameobjects
+package components
import (
coreobjects "github.com/DegustatorPonos/RuinesOfRafdolon/CoreObjects"
@@ -10,12 +10,12 @@ var texture rl.Texture2D
type Tile struct {
}
-type Field struct {
+type World struct {
Tiles [][]Tile
Camera rl.Camera2D
}
-func (base *Field) Create(_ coreobjects.SceneManager) {
+func (base *World) Create(_ coreobjects.SceneManager) {
var image = rl.LoadImage("tile.png")
texture = rl.LoadTextureFromImage(image)
rl.UnloadImage(image)
@@ -27,11 +27,11 @@ func (base *Field) Create(_ coreobjects.SceneManager) {
base.Camera.Zoom = 2
}
-func (base *Field) Destroy() {
+func (base *World) Destroy() {
rl.UnloadTexture(texture)
}
-func (base *Field) Update() {
+func (base *World) Update() {
if rl.IsKeyDown(rl.KeyW) {
base.Camera.Target.Y -= 0.3
}
@@ -46,7 +46,7 @@ func (base *Field) Update() {
}
}
-func (base *Field) Draw() {
+func (base *World) Draw() {
rl.BeginMode2D(base.Camera)
defer rl.EndMode2D()
@@ -57,12 +57,12 @@ func (base *Field) Draw() {
}
}
-func CreateField(x int, y int) Field {
+func CreateWorld(x int, y int) World {
var tiles = make([][]Tile, x)
for i := range tiles {
tiles[i] = make([]Tile, y)
}
- return Field {
+ return World {
Tiles: tiles,
}
}
diff --git a/engine/CoreObjects/Object.go b/engine/CoreObjects/GameObject.go
index 6f0a808..255a405 100644
--- a/engine/CoreObjects/Object.go
+++ b/engine/CoreObjects/GameObject.go
@@ -1,6 +1,6 @@
package coreobjects
-type Object interface {
+type GameObject interface {
Create(SceneManager)
Destroy()
Update()
diff --git a/engine/Settings/Flags.go b/engine/Settings/Flags.go
index 9f4039e..6c5d1f4 100644
--- a/engine/Settings/Flags.go
+++ b/engine/Settings/Flags.go
@@ -22,7 +22,14 @@ func (base Flags) String() string {
func readFlags() *Flags {
- return &Flags {
- SettingsFileLocation: *flag.String("c", "Config.json", "Configurtation file location"),
+ var outp = Flags{}
+ if flag.Lookup("c") == nil {
+ flag.StringVar(&outp.SettingsFileLocation, "c", "Config.json", "Configurtation file location")
}
+ flag.Parse()
+ return &outp
+
+ // return &Flags {
+ // SettingsFileLocation: *flag.String("config", "Config.json", "Configurtation file location"),
+ // }
}
diff --git a/engine/main.go b/engine/main.go
index 47e07b3..8d11769 100644
--- a/engine/main.go
+++ b/engine/main.go
@@ -1,8 +1,8 @@
package main
import (
+ components "github.com/DegustatorPonos/RuinesOfRafdolon/Components"
coreobjects "github.com/DegustatorPonos/RuinesOfRafdolon/CoreObjects"
- gameobjects "github.com/DegustatorPonos/RuinesOfRafdolon/GameObjects"
render "github.com/DegustatorPonos/RuinesOfRafdolon/Render"
settings "github.com/DegustatorPonos/RuinesOfRafdolon/Settings"
)
@@ -10,7 +10,7 @@ import (
func main() {
settings.ReadSettings()
// TEMPORARY SECTION
- var field = gameobjects.CreateField(8, 8)
+ var field = components.CreateWorld(8, 8)
var manager = coreobjects.InitSceneManager()
render.InitWindow(manager, &field)