Try to detach the camera and compile for 3DS

This commit is contained in:
2024-11-05 11:16:58 +01:00
parent 266e8f7507
commit 0b0c6a5191
2 changed files with 34 additions and 2 deletions

26
Makefile Normal file
View File

@@ -0,0 +1,26 @@
# DevkitPro and DevkitARM path
DEVKITPRO ?= /opt/devkitpro
DEVKITARM ?= $(DEVKITPRO)/devkitARM
# Project name
TARGET := bloubloulespoissons
BUILD := build
SOURCES := .
INCLUDES := .
# Libraries
LIBS := -lSDL2 -lSDL2_image -lSDL2_ttf
# Compiler and linker settings
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
CFLAGS := -g -O2 -Wall -mword-relocations $(ARCH) -I$(DEVKITPRO)/libctru/include -I$(INCLUDES)
LDFLAGS := -L$(DEVKITPRO)/libctru/lib $(LIBS)
# Rules
all: $(BUILD)/$(TARGET).3dsx
$(BUILD)/$(TARGET).3dsx: $(BUILD)/$(TARGET).elf
3dsxtool $(BUILD)/$(TARGET).elf $@
$(BUILD)/$(TARGET).elf: $(SOURCES)/*.cpp
$(DEVKITARM)/bin/arm-none-eabi-g++ $(CFLAGS) -o $@ $^ $(LDFLAGS)

View File

@@ -249,12 +249,18 @@ void handleEvents(int& playerX, int& playerY, const int playerSpeed) {
Camera& camera = Camera::getInstance();
if (keystate[SDL_SCANCODE_W]) {
if(camera.getY() > -playerBaseY) {
if (playerY > 0) {
playerY -= playerSpeed;
}
if (camera.getY() > 0 && playerY < playerBaseY) {
camera.move(0, -playerSpeed);
}
}
if (keystate[SDL_SCANCODE_S]) {
if(camera.getY() < ENV_HEIGHT - windowHeight) {
if (playerY < ENV_HEIGHT - 75) {
playerY += playerSpeed;
}
if (camera.getY() < ENV_HEIGHT - windowHeight && playerY > playerBaseY) {
camera.move(0, playerSpeed);
}
}