summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthe lemons <citrons@mondecitronne.com>2023-02-07 18:14:47 -0600
committerthe lemons <citrons@mondecitronne.com>2023-02-07 18:14:47 -0600
commit52fdf6319f79b41dbc8531556c0334d538d2dae3 (patch)
tree1e0139b60103f454dd0ff98ecb1d43a9398fbb09
parentc651762762dd9463aacecd703b31d81042a42473 (diff)
fix rounding of positions onscreen
-rw-r--r--Makefile4
-rw-r--r--core.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 50a35f4..4345b7e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,9 @@
SDL_HEADERS=/usr/include/SDL2
+#CFLAGS=-g -Wall -fsanitize=undefined -fsanitize=address -I$(SDL_HEADERS)
CFLAGS=-g -Wall -I$(SDL_HEADERS)
-LFLAGS=-lSDL2
+#LFLAGS=-lSDL2 -fsanitize=undefined -fsanitize=address
+LFLAGS=-lSDL2 -lm
core: core.o procfs.o memview.o
$(CC) -o $@ $^ $(LFLAGS)
diff --git a/core.c b/core.c
index 04cab5a..7129bbc 100644
--- a/core.c
+++ b/core.c
@@ -37,8 +37,8 @@ static void add_scale(double amount) {
}
static void world_pos(double *x, double *y) {
- *x = *x / scale + pos_x - 0.5;
- *y = *y / scale + pos_y - 0.5;
+ *x = *x / scale + floor(pos_x);
+ *y = *y / scale + floor(pos_y);
}
static void goto_addr(uintptr_t addr) {