From 55ee9755037cb7bf52cae03ddcc34bd169d5af41 Mon Sep 17 00:00:00 2001 From: Dima Marhitych Date: Tue, 17 Oct 2023 21:58:37 +0200 Subject: [PATCH] Fix for new path system --- Makefile | 2 +- example/example.go | 2 +- src/entity/entity.go | 10 +++++----- tests/test1/test1.go | 14 +++++++++----- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 893ae2e..013362d 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ example: @echo " ----------------------------------------------------" @echo - $(EXAMPLE_BUILD_TOOL) ./example/ + $(EXAMPLE_BUILD_TOOL) ./example/example.go release: @echo diff --git a/example/example.go b/example/example.go index a947780..1279fdb 100644 --- a/example/example.go +++ b/example/example.go @@ -2,7 +2,7 @@ package main import ( // Import the webzen package - "github.com/dimkauzh/webzen" + "github.com/dimkauzh/webzen/" // Import the webzen draw package "github.com/dimkauzh/webzen/src/draw" diff --git a/src/entity/entity.go b/src/entity/entity.go index f2981bf..a4f8df2 100644 --- a/src/entity/entity.go +++ b/src/entity/entity.go @@ -4,13 +4,13 @@ package entity import ( - "github.com/dimkauzh/webzen/src/webzen/image" - "github.com/dimkauzh/webzen/src/webzen/shape" + "github.com/dimkauzh/webzen/src/image" + "github.com/dimkauzh/webzen/src/shape" + "github.com/dimkauzh/webzen/src/vector" ) type Entity struct { - x int - y int + pos vector.Vector2D width int height int image image.Image @@ -18,7 +18,7 @@ type Entity struct { } func NewEntity(x int, y int, width int, height int) Entity { - return Entity{x, y, width, height, nil, nil} + return Entity{vector.NewVector2D(x, y), width, height, nil, nil} } func (e *Entity) SetImage(image image.Image) { diff --git a/tests/test1/test1.go b/tests/test1/test1.go index acd968a..e43cd10 100644 --- a/tests/test1/test1.go +++ b/tests/test1/test1.go @@ -1,11 +1,11 @@ package main import ( - "github.com/dimkauzh/webzen/src/webzen" - "github.com/dimkauzh/webzen/src/webzen/draw" - "github.com/dimkauzh/webzen/src/webzen/keys" - "github.com/dimkauzh/webzen/src/webzen/tools" - "github.com/dimkauzh/webzen/src/webzen/ui" + "github.com/dimkauzh/webzen" + "github.com/dimkauzh/webzen/src/draw" + "github.com/dimkauzh/webzen/src/keys" + "github.com/dimkauzh/webzen/src/tools" + "github.com/dimkauzh/webzen/src/ui" ) func main() { @@ -23,6 +23,10 @@ func main() { if keys.KeyPressedOnce("a") { tools.Print("A key pressed") } + + pos := keys.GetMousePos() + + tools.Print(pos[0], pos[1]) webzen.Update() } }