11 Commits

33 changed files with 10412 additions and 207 deletions

Binary file not shown.

10
.gitignore vendored
View File

@ -1,6 +1,9 @@
# ---> KDevelop4
*.kdev4
.kdev4/
#*.kdev4
#.kdev4/
# ---> build artifacts
build/*
# ---> C++
# Prerequisites
@ -89,3 +92,6 @@ Module.symvers
Mkfile.old
dkms.conf
# CMake artifacts
CMakeCache.txt

View File

@ -0,0 +1,62 @@
[Buildset]
BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x18\x00B\x00e\x00a\x00g\x00l\x00e\x00R\x00e\x00s\x00c\x00u\x00e)
[CMake]
Build Directory Count=1
Current Build Directory Index-Host System=0
[CMake][CMake Build Directory 0]
Build Directory Path=/home/ayoungblood/BeagleRescue.git/build
Build Type=Release
CMake Binary=/usr/bin/cmake
CMake Executable=/usr/bin/cmake
Environment Profile=
Extra Arguments=
Install Directory=/usr/local
Runtime=Host System
[CustomDefinesAndIncludes][ProjectPath0]
Path=.
parseAmbiguousAsCPP=true
parserArguments=-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c++17
parserArgumentsC=-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c99
parserArgumentsCuda=-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c++11
parserArgumentsOpenCL=-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -cl-std=CL1.1
[CustomDefinesAndIncludes][ProjectPath0][Compiler]
Name=GCC
[Launch]
Launch Configurations=Launch Configuration 0
[Launch][Launch Configuration 0]
Configured Launch Modes=execute,debug
Configured Launchers=nativeAppLauncher,lldb
Name=BeagleRescue
Type=Native Application
[Launch][Launch Configuration 0][Data]
Arguments=
Break on Start=false
Dependencies=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x00)
Dependency Action=Nothing
EnvironmentGroup=
Executable=file:///home/ayoungblood/BeagleRescue.git/build/BeagleRescue
External Terminal=konsole --noclose --workdir %workdir -e %exe
Kill Before Executing Again=4194304
LLDB Arguments=
LLDB Config Script=
LLDB Environment=
LLDB Executable=
LLDB Inherit System Env=true
LLDB Remote Debugging=false
LLDB Remote Path=
LLDB Remote Server=
Project Target=BeagleRescue,BeagleRescue
Start With=ApplicationOutput
Use External Terminal=false
Working Directory=file:///home/ayoungblood/BeagleRescue.git
isExecutable=true
[Project]
VersionControlSupport=kdevgit

51
.kdev4/BeagleRescue.kdev4 Normal file
View File

@ -0,0 +1,51 @@
[Buildset]
BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x18\x00B\x00e\x00a\x00g\x00l\x00e\x00R\x00e\x00s\x00c\x00u\x00e)
[CMake]
Build Directory Count=2
Current Build Directory Index-Host System=0
Temporary Build Directory Index=1
[CMake][CMake Build Directory 0]
Build Directory Path=/home/ayoungblood/projects/BeagleRescue/build
Build Type=Release
CMake Binary=/usr/bin/cmake
CMake Executable=/usr/bin/cmake
Environment Profile=
Extra Arguments=
Install Directory=/usr/local
Runtime=Host System
[CMake][CMake Build Directory 1]
Build Directory Path=/home/ayoungblood/Projects/BeagleRescue/build
Build Type=Release
CMake Binary=/usr/bin/cmake
CMake Executable=/usr/bin/cmake
Environment Profile=
Extra Arguments=
Install Directory=
[Launch]
Launch Configurations=Launch Configuration 0
[Launch][Launch Configuration 0]
Configured Launch Modes=execute
Configured Launchers=nativeAppLauncher
Name=BeagleRescue
Type=Native Application
[Launch][Launch Configuration 0][Data]
Arguments=
Dependencies=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x00)
Dependency Action=Nothing
EnvironmentGroup=
Executable=file:///home/ayoungblood/Projects/BeagleRescue
External Terminal=konsole --noclose --workdir %workdir -e %exe
Kill Before Executing Again=4194304
Project Target=BeagleRescue,BeagleRescue
Use External Terminal=false
Working Directory=file:///home/ayoungblood/projects/BeagleRescue
isExecutable=true
[Project]
VersionControlSupport=kdevgit

4
BeagleRescue.git.kdev4 Normal file
View File

@ -0,0 +1,4 @@
[Project]
CreatedFrom=CMakeLists.txt
Manager=KDevCMakeManager
Name=BeagleRescue

5
BeagleRescue.kdev4 Normal file
View File

@ -0,0 +1,5 @@
[Project]
CreatedFrom=CMakeLists.txt
Manager=KDevCMakeManager
Name=BeagleRescue
VersionControl=%{VERSIONCONTROLPLUGIN}

58
CMakeLists.txt Normal file
View File

@ -0,0 +1,58 @@
cmake_minimum_required(VERSION 3.25.1)
project(BeagleRescue VERSION 1.0.0 )
#set(CMAKE_CXX_STANDARD 11) # old requirements
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to be used") # new requirements for tileson
set(CMAKE_CXX_REQUIRED ON)
include(FetchContent)
include(FindPkgConfig)
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
PKG_SEARCH_MODULE(SDL2IMAGE REQUIRED SDL2_image>=2.0.0)
PKG_SEARCH_MODULE(SDL2MIXER REQUIRED SDL2_mixer>=2.0.0)
# Point to our own cmake modules
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/sdl2)
# Find SDL2
# find_package(SDL2 REQUIRED)
#find_file(SDL2_INCLUDE_DIR NAME SDL.h HINTS SDL2)
#find_library(SDL2_LIBRARY NAME SDL2)
#find_package(SDL2_image REQUIRED)
#find_package(SDL2_mixer REQUIRED)
#add_subdirectory(libtmx-parser)
#add_library(libtmx-parser)
# target_sources(libtmx-parser
# PRIVATE
# $(CMAKE_CURRENT_LIST_DIR)/libtmx-parser/src/base64.h
# $(CMAKE_CURRENT_LIST_DIR)/libtmx-parser/src/base64.cpp
# $(CMAKE_CURRENT_LIST_DIR)/libtmx-parser/src/tmxparser.cpp
# PUBLIC
# $(CMAKE_CURRENT_LIST_DIR)/libtmx-parser/src/tmxparser.h
# )
#set(TMXPARSER "tmxparser")
#FetchContent_Declare(
# tmxparser
# GIT_REPOSITORY "https://github.com/halsafar/libtmx-parser"
# GIT_TAG "master"
# )
#FetchContent_MakeAvailable(tmxparser)
# Add global definitions
add_definitions("-Wall")
include_directories(${PROJECT_NAME} ${SDL2_INCLUDE_DIRS} ${SDL2IMAGE_INCLUDE_DIRS} ${SDL2MIXER_INCLUDE_DIRS})
#add_custom_target(${TMXPARSER})
# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libtmx-parser/)
file(GLOB_RECURSE CSOURCES src/cjson/*.c)
file(GLOB_RECURSE CPPSOURCES src/*.cpp)
# file(GLOB_RECURSE TMXSOURCES libtmx-parser/src/*.cpp)
#add_dependencies(${PROJECT_NAME} ${TMXPARSER})
add_executable(${PROJECT_NAME} ${CSOURCES} ${CPPSOURCES})
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
target_link_libraries(${PROJECT_NAME} PRIVATE ${SDL2_LIBRARIES} ${SDL2IMAGE_LIBRARIES} ${SDL2MIXER_LIBRARIES})

628
Makefile
View File

@ -1,52 +1,608 @@
# Special Thanks to Job Vranish at Atomic Object for the base Makefile that was modified slightly to work with this project's needs
# https://spin.atomicobject.com/2016/08/26/makefile-c-projects/
TARGET_EXEC ?= BeagleRescue.exe
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.25
BUILD_DIR ?= .\build
SRC_DIRS ?= .\src
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
#SRCS := $(shell find $(SRC_DIRS) -name '*.cpp' -or -name '*.c' -or -name '*.s')
SRCS := $(shell dir .\*.cpp /s /b)
OBJS := $(SRCS:%=$(BUILD_DIR)\%.o)
DEPS := $(OBJS:.o=.d)
# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:
#INC_DIRS := $(shell find $(SRC_DIRS) -type d)
INC_DIRS := $(dir .\src /ad /b /s )
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
#=============================================================================
# Special targets provided by cmake.
INCLUDE_PATHS = -IC:\mingw_dev_lib\sdl2\include\SDL2 -IC:\mingw_dev_lib\sdl_image\include\SDL2 -IC:\mingw_dev_lib\sdl_mixer\include\SDL2
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
LIBRARY_PATHS = -LC:\mingw_dev_lib\sdl2\lib -LC:\mingw_dev_lib\sdl2_image\lib -LC:\mingw_dev_lib\sdl2_mixer\lib
# Disable VCS-based implicit rules.
% : %,v
CPPFLAGS ?= $(INC_FLAGS) -Ilibsdl2/include -Ilibtmx-parser/src -Ilibtmx-parser/libs/tinyxml2 -MMD -MP -w
COMPILER_FLAGS = -w "-Wl,-subsystem,windows" #Quotes used to force Powershell to parse correctly
# Disable VCS-based implicit rules.
% : RCS/%
#LINKER_FLAGS = libsdl2/build/.libs/libSDL2.a libsdl2_image/.libs/libSDL2_image.a libsdl2_mixer/build/.libs/libSDL2_mixer.a libtmx-parser/libtmxparser.a
$(BUILD_DIR)\$(TARGET_EXEC): $(OBJS)
# Disable VCS-based implicit rules.
% : RCS/%,v
# $(CC) $(OBJS) -o $@ $(LDFLAGS)
$(CXX) $(OBJS) $(LINKER_FLAGS) -o $@
# Disable VCS-based implicit rules.
% : SCCS/s.%
# assembly
$(BUILD_DIR)/%.s.o: %.s
$(MKDIR_P) $(dir $@)
$(AS) $(ASFLAGS) -c $< -o $@
# Disable VCS-based implicit rules.
% : s.%
# c source
$(BUILD_DIR)/%.c.o: %.c
$(MKDIR_P) $(dir $@)
$(CXX) $(CPPFLAGS) $(INCLUDE_PATHS) $(LIBRARY_PATHS) $(COMPILER_FLAGS) $(CFLAGS) $(LINKER_FLAGS) -c $< -o $@
.SUFFIXES: .hpux_make_needs_suffix_list
# c++ source
$(BUILD_DIR)/%.cpp.o: %.cpp
$(MKDIR_P) $(dir $@)
$(CXX) $(CPPFLAGS) $(INCLUDE_PATHS) $(LIBRARY_PATHS) $(COMPILER_FLAGS) $(CXXFLAGS) $(LINKER_FLAGS) -c $< -o $@
# Command-line flag to silence nested $(MAKE).
$(VERBOSE)MAKESILENT = -s
.PHONY: clean
#Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake
# The command to remove a file.
RM = /usr/bin/cmake -E rm -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/ayoungblood/Projects/BeagleRescue
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/ayoungblood/Projects/BeagleRescue
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."
/usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# Special rule for the target list_install_components
list_install_components:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
.PHONY : list_install_components
# Special rule for the target list_install_components
list_install_components/fast: list_install_components
.PHONY : list_install_components/fast
# Special rule for the target install
install: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/bin/cmake -P cmake_install.cmake
.PHONY : install
# Special rule for the target install
install/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/bin/cmake -P cmake_install.cmake
.PHONY : install/fast
# Special rule for the target install/local
install/local: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
/usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local
# Special rule for the target install/local
install/local/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
/usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local/fast
# Special rule for the target install/strip
install/strip: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
/usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip
# Special rule for the target install/strip
install/strip/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
/usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip/fast
# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /home/ayoungblood/Projects/BeagleRescue/CMakeFiles /home/ayoungblood/Projects/BeagleRescue//CMakeFiles/progress.marks
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /home/ayoungblood/Projects/BeagleRescue/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
-del -fR $(BUILD_DIR)
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean
.PHONY : clean
-include $(DEPS)
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast
# clear depends
depend:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
#=============================================================================
# Target rules for targets named BeagleRescue
# Build rule for target.
BeagleRescue: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 BeagleRescue
.PHONY : BeagleRescue
# fast build rule for target.
BeagleRescue/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/build
.PHONY : BeagleRescue/fast
src/assetmgr/AssetManager.o: src/assetmgr/AssetManager.cpp.o
.PHONY : src/assetmgr/AssetManager.o
# target to build an object file
src/assetmgr/AssetManager.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/assetmgr/AssetManager.cpp.o
.PHONY : src/assetmgr/AssetManager.cpp.o
src/assetmgr/AssetManager.i: src/assetmgr/AssetManager.cpp.i
.PHONY : src/assetmgr/AssetManager.i
# target to preprocess a source file
src/assetmgr/AssetManager.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/assetmgr/AssetManager.cpp.i
.PHONY : src/assetmgr/AssetManager.cpp.i
src/assetmgr/AssetManager.s: src/assetmgr/AssetManager.cpp.s
.PHONY : src/assetmgr/AssetManager.s
# target to generate assembly for a file
src/assetmgr/AssetManager.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/assetmgr/AssetManager.cpp.s
.PHONY : src/assetmgr/AssetManager.cpp.s
src/assetmgr/GameObject.o: src/assetmgr/GameObject.cpp.o
.PHONY : src/assetmgr/GameObject.o
# target to build an object file
src/assetmgr/GameObject.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/assetmgr/GameObject.cpp.o
.PHONY : src/assetmgr/GameObject.cpp.o
src/assetmgr/GameObject.i: src/assetmgr/GameObject.cpp.i
.PHONY : src/assetmgr/GameObject.i
# target to preprocess a source file
src/assetmgr/GameObject.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/assetmgr/GameObject.cpp.i
.PHONY : src/assetmgr/GameObject.cpp.i
src/assetmgr/GameObject.s: src/assetmgr/GameObject.cpp.s
.PHONY : src/assetmgr/GameObject.s
# target to generate assembly for a file
src/assetmgr/GameObject.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/assetmgr/GameObject.cpp.s
.PHONY : src/assetmgr/GameObject.cpp.s
src/assetmgr/Map.o: src/assetmgr/Map.cpp.o
.PHONY : src/assetmgr/Map.o
# target to build an object file
src/assetmgr/Map.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/assetmgr/Map.cpp.o
.PHONY : src/assetmgr/Map.cpp.o
src/assetmgr/Map.i: src/assetmgr/Map.cpp.i
.PHONY : src/assetmgr/Map.i
# target to preprocess a source file
src/assetmgr/Map.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/assetmgr/Map.cpp.i
.PHONY : src/assetmgr/Map.cpp.i
src/assetmgr/Map.s: src/assetmgr/Map.cpp.s
.PHONY : src/assetmgr/Map.s
# target to generate assembly for a file
src/assetmgr/Map.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/assetmgr/Map.cpp.s
.PHONY : src/assetmgr/Map.cpp.s
src/assetmgr/MusicManager.o: src/assetmgr/MusicManager.cpp.o
.PHONY : src/assetmgr/MusicManager.o
# target to build an object file
src/assetmgr/MusicManager.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/assetmgr/MusicManager.cpp.o
.PHONY : src/assetmgr/MusicManager.cpp.o
src/assetmgr/MusicManager.i: src/assetmgr/MusicManager.cpp.i
.PHONY : src/assetmgr/MusicManager.i
# target to preprocess a source file
src/assetmgr/MusicManager.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/assetmgr/MusicManager.cpp.i
.PHONY : src/assetmgr/MusicManager.cpp.i
src/assetmgr/MusicManager.s: src/assetmgr/MusicManager.cpp.s
.PHONY : src/assetmgr/MusicManager.s
# target to generate assembly for a file
src/assetmgr/MusicManager.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/assetmgr/MusicManager.cpp.s
.PHONY : src/assetmgr/MusicManager.cpp.s
src/assetmgr/TextureManager.o: src/assetmgr/TextureManager.cpp.o
.PHONY : src/assetmgr/TextureManager.o
# target to build an object file
src/assetmgr/TextureManager.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/assetmgr/TextureManager.cpp.o
.PHONY : src/assetmgr/TextureManager.cpp.o
src/assetmgr/TextureManager.i: src/assetmgr/TextureManager.cpp.i
.PHONY : src/assetmgr/TextureManager.i
# target to preprocess a source file
src/assetmgr/TextureManager.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/assetmgr/TextureManager.cpp.i
.PHONY : src/assetmgr/TextureManager.cpp.i
src/assetmgr/TextureManager.s: src/assetmgr/TextureManager.cpp.s
.PHONY : src/assetmgr/TextureManager.s
# target to generate assembly for a file
src/assetmgr/TextureManager.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/assetmgr/TextureManager.cpp.s
.PHONY : src/assetmgr/TextureManager.cpp.s
src/cjson/cJSON.o: src/cjson/cJSON.c.o
.PHONY : src/cjson/cJSON.o
# target to build an object file
src/cjson/cJSON.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/cjson/cJSON.c.o
.PHONY : src/cjson/cJSON.c.o
src/cjson/cJSON.i: src/cjson/cJSON.c.i
.PHONY : src/cjson/cJSON.i
# target to preprocess a source file
src/cjson/cJSON.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/cjson/cJSON.c.i
.PHONY : src/cjson/cJSON.c.i
src/cjson/cJSON.s: src/cjson/cJSON.c.s
.PHONY : src/cjson/cJSON.s
# target to generate assembly for a file
src/cjson/cJSON.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/cjson/cJSON.c.s
.PHONY : src/cjson/cJSON.c.s
src/ecs/ECS.o: src/ecs/ECS.cpp.o
.PHONY : src/ecs/ECS.o
# target to build an object file
src/ecs/ECS.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/ecs/ECS.cpp.o
.PHONY : src/ecs/ECS.cpp.o
src/ecs/ECS.i: src/ecs/ECS.cpp.i
.PHONY : src/ecs/ECS.i
# target to preprocess a source file
src/ecs/ECS.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/ecs/ECS.cpp.i
.PHONY : src/ecs/ECS.cpp.i
src/ecs/ECS.s: src/ecs/ECS.cpp.s
.PHONY : src/ecs/ECS.s
# target to generate assembly for a file
src/ecs/ECS.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/ecs/ECS.cpp.s
.PHONY : src/ecs/ECS.cpp.s
src/game/Collision.o: src/game/Collision.cpp.o
.PHONY : src/game/Collision.o
# target to build an object file
src/game/Collision.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/Collision.cpp.o
.PHONY : src/game/Collision.cpp.o
src/game/Collision.i: src/game/Collision.cpp.i
.PHONY : src/game/Collision.i
# target to preprocess a source file
src/game/Collision.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/Collision.cpp.i
.PHONY : src/game/Collision.cpp.i
src/game/Collision.s: src/game/Collision.cpp.s
.PHONY : src/game/Collision.s
# target to generate assembly for a file
src/game/Collision.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/Collision.cpp.s
.PHONY : src/game/Collision.cpp.s
src/game/Game.o: src/game/Game.cpp.o
.PHONY : src/game/Game.o
# target to build an object file
src/game/Game.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/Game.cpp.o
.PHONY : src/game/Game.cpp.o
src/game/Game.i: src/game/Game.cpp.i
.PHONY : src/game/Game.i
# target to preprocess a source file
src/game/Game.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/Game.cpp.i
.PHONY : src/game/Game.cpp.i
src/game/Game.s: src/game/Game.cpp.s
.PHONY : src/game/Game.s
# target to generate assembly for a file
src/game/Game.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/Game.cpp.s
.PHONY : src/game/Game.cpp.s
src/game/GameStateManager.o: src/game/GameStateManager.cpp.o
.PHONY : src/game/GameStateManager.o
# target to build an object file
src/game/GameStateManager.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/GameStateManager.cpp.o
.PHONY : src/game/GameStateManager.cpp.o
src/game/GameStateManager.i: src/game/GameStateManager.cpp.i
.PHONY : src/game/GameStateManager.i
# target to preprocess a source file
src/game/GameStateManager.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/GameStateManager.cpp.i
.PHONY : src/game/GameStateManager.cpp.i
src/game/GameStateManager.s: src/game/GameStateManager.cpp.s
.PHONY : src/game/GameStateManager.s
# target to generate assembly for a file
src/game/GameStateManager.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/GameStateManager.cpp.s
.PHONY : src/game/GameStateManager.cpp.s
src/game/Main.o: src/game/Main.cpp.o
.PHONY : src/game/Main.o
# target to build an object file
src/game/Main.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/Main.cpp.o
.PHONY : src/game/Main.cpp.o
src/game/Main.i: src/game/Main.cpp.i
.PHONY : src/game/Main.i
# target to preprocess a source file
src/game/Main.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/Main.cpp.i
.PHONY : src/game/Main.cpp.i
src/game/Main.s: src/game/Main.cpp.s
.PHONY : src/game/Main.s
# target to generate assembly for a file
src/game/Main.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/Main.cpp.s
.PHONY : src/game/Main.cpp.s
src/game/StateMachine.o: src/game/StateMachine.cpp.o
.PHONY : src/game/StateMachine.o
# target to build an object file
src/game/StateMachine.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/StateMachine.cpp.o
.PHONY : src/game/StateMachine.cpp.o
src/game/StateMachine.i: src/game/StateMachine.cpp.i
.PHONY : src/game/StateMachine.i
# target to preprocess a source file
src/game/StateMachine.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/StateMachine.cpp.i
.PHONY : src/game/StateMachine.cpp.i
src/game/StateMachine.s: src/game/StateMachine.cpp.s
.PHONY : src/game/StateMachine.s
# target to generate assembly for a file
src/game/StateMachine.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/StateMachine.cpp.s
.PHONY : src/game/StateMachine.cpp.s
src/game/Vector2D.o: src/game/Vector2D.cpp.o
.PHONY : src/game/Vector2D.o
# target to build an object file
src/game/Vector2D.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/Vector2D.cpp.o
.PHONY : src/game/Vector2D.cpp.o
src/game/Vector2D.i: src/game/Vector2D.cpp.i
.PHONY : src/game/Vector2D.i
# target to preprocess a source file
src/game/Vector2D.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/Vector2D.cpp.i
.PHONY : src/game/Vector2D.cpp.i
src/game/Vector2D.s: src/game/Vector2D.cpp.s
.PHONY : src/game/Vector2D.s
# target to generate assembly for a file
src/game/Vector2D.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/game/Vector2D.cpp.s
.PHONY : src/game/Vector2D.cpp.s
src/ui/UINineSlice.o: src/ui/UINineSlice.cpp.o
.PHONY : src/ui/UINineSlice.o
# target to build an object file
src/ui/UINineSlice.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/ui/UINineSlice.cpp.o
.PHONY : src/ui/UINineSlice.cpp.o
src/ui/UINineSlice.i: src/ui/UINineSlice.cpp.i
.PHONY : src/ui/UINineSlice.i
# target to preprocess a source file
src/ui/UINineSlice.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/ui/UINineSlice.cpp.i
.PHONY : src/ui/UINineSlice.cpp.i
src/ui/UINineSlice.s: src/ui/UINineSlice.cpp.s
.PHONY : src/ui/UINineSlice.s
# target to generate assembly for a file
src/ui/UINineSlice.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/ui/UINineSlice.cpp.s
.PHONY : src/ui/UINineSlice.cpp.s
src/ui/UIText.o: src/ui/UIText.cpp.o
.PHONY : src/ui/UIText.o
# target to build an object file
src/ui/UIText.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/ui/UIText.cpp.o
.PHONY : src/ui/UIText.cpp.o
src/ui/UIText.i: src/ui/UIText.cpp.i
.PHONY : src/ui/UIText.i
# target to preprocess a source file
src/ui/UIText.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/ui/UIText.cpp.i
.PHONY : src/ui/UIText.cpp.i
src/ui/UIText.s: src/ui/UIText.cpp.s
.PHONY : src/ui/UIText.s
# target to generate assembly for a file
src/ui/UIText.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/BeagleRescue.dir/build.make CMakeFiles/BeagleRescue.dir/src/ui/UIText.cpp.s
.PHONY : src/ui/UIText.cpp.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... install"
@echo "... install/local"
@echo "... install/strip"
@echo "... list_install_components"
@echo "... rebuild_cache"
@echo "... BeagleRescue"
@echo "... src/assetmgr/AssetManager.o"
@echo "... src/assetmgr/AssetManager.i"
@echo "... src/assetmgr/AssetManager.s"
@echo "... src/assetmgr/GameObject.o"
@echo "... src/assetmgr/GameObject.i"
@echo "... src/assetmgr/GameObject.s"
@echo "... src/assetmgr/Map.o"
@echo "... src/assetmgr/Map.i"
@echo "... src/assetmgr/Map.s"
@echo "... src/assetmgr/MusicManager.o"
@echo "... src/assetmgr/MusicManager.i"
@echo "... src/assetmgr/MusicManager.s"
@echo "... src/assetmgr/TextureManager.o"
@echo "... src/assetmgr/TextureManager.i"
@echo "... src/assetmgr/TextureManager.s"
@echo "... src/cjson/cJSON.o"
@echo "... src/cjson/cJSON.i"
@echo "... src/cjson/cJSON.s"
@echo "... src/ecs/ECS.o"
@echo "... src/ecs/ECS.i"
@echo "... src/ecs/ECS.s"
@echo "... src/game/Collision.o"
@echo "... src/game/Collision.i"
@echo "... src/game/Collision.s"
@echo "... src/game/Game.o"
@echo "... src/game/Game.i"
@echo "... src/game/Game.s"
@echo "... src/game/GameStateManager.o"
@echo "... src/game/GameStateManager.i"
@echo "... src/game/GameStateManager.s"
@echo "... src/game/Main.o"
@echo "... src/game/Main.i"
@echo "... src/game/Main.s"
@echo "... src/game/StateMachine.o"
@echo "... src/game/StateMachine.i"
@echo "... src/game/StateMachine.s"
@echo "... src/game/Vector2D.o"
@echo "... src/game/Vector2D.i"
@echo "... src/game/Vector2D.s"
@echo "... src/ui/UINineSlice.o"
@echo "... src/ui/UINineSlice.i"
@echo "... src/ui/UINineSlice.s"
@echo "... src/ui/UIText.o"
@echo "... src/ui/UIText.i"
@echo "... src/ui/UIText.s"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system
MKDIR_P ?= mkdir -p

View File

@ -1,53 +0,0 @@
# Special Thanks to Job Vranish at Atomic Object for the base Makefile that was modified slightly to work with this project's needs
# https://spin.atomicobject.com/2016/08/26/makefile-c-projects/
TARGET_EXEC ?= BeagleRescue.exe
BUILD_DIR ?= .\build
SRC_DIRS ?= .\src
#SRCS := $(shell find $(SRC_DIRS) -name '*.cpp' -or -name '*.c' -or -name '*.s')
SRCS := $(shell dir .\*.cpp /s /b)
OBJS := $(SRCS:%=$(BUILD_DIR)\%.o)
DEPS := $(OBJS:.o=.d)
#INC_DIRS := $(shell find $(SRC_DIRS) -type d)
INC_DIRS := $(dir .\src /ad /b /s )
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
INCLUDE_PATHS = -IC:\mingw_dev_lib\sdl2\include\SDL2 -IC:\mingw_dev_lib\sdl_image\include\SDL2 -IC:\mingw_dev_lib\sdl_mixer\include\SDL2
LIBRARY_PATHS = -LC:\mingw_dev_lib\sdl2\lib -LC:\mingw_dev_lib\sdl2_image\lib -LC:\mingw_dev_lib\sdl2_mixer\lib
CPPFLAGS ?= $(INC_FLAGS) -Ilibsdl2/include -Ilibtmx-parser/src -Ilibtmx-parser/libs/tinyxml2 -MMD -MP -w
COMPILER_FLAGS = -w "-Wl,-subsystem,windows" #Quotes used to force Powershell to parse correctly
all:
#LINKER_FLAGS = libsdl2/build/.libs/libSDL2.a libsdl2_image/.libs/libSDL2_image.a libsdl2_mixer/build/.libs/libSDL2_mixer.a libtmx-parser/libtmxparser.a
$(BUILD_DIR)\$(TARGET_EXEC): $(OBJS)
# $(CC) $(OBJS) -o $@ $(LDFLAGS)
$(CXX) $(OBJS) $(LINKER_FLAGS) -o $@
# assembly
$(BUILD_DIR)/%.s.o: %.s
$(MKDIR_P) $(dir $@)
$(AS) $(ASFLAGS) -c $< -o $@
# c source
$(BUILD_DIR)/%.c.o: %.c
$(MKDIR_P) $(dir $@)
$(CXX) $(CPPFLAGS) $(INCLUDE_PATHS) $(LIBRARY_PATHS) $(COMPILER_FLAGS) $(CFLAGS) $(LINKER_FLAGS) -c $< -o $@
# c++ source
$(BUILD_DIR)/%.cpp.o: %.cpp
$(MKDIR_P) $(dir $@)
$(CXX) $(CPPFLAGS) $(INCLUDE_PATHS) $(LIBRARY_PATHS) $(COMPILER_FLAGS) $(CXXFLAGS) $(LINKER_FLAGS) -c $< -o $@
.PHONY: clean
clean:
-del -fR $(BUILD_DIR)
-include $(DEPS)
MKDIR_P ?= mkdir -p

338
assets/maps/br-tiles.tsj Normal file
View File

@ -0,0 +1,338 @@
{ "columns":10,
"image":"..\/..\/..\/Projects\/BeagleRescue\/assets\/maps\/br-tiles.png",
"imageheight":80,
"imagewidth":160,
"margin":0,
"name":"br-tiles",
"spacing":0,
"tilecount":50,
"tiledversion":"1.8.2",
"tileheight":16,
"tiles":[
{
"id":10,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
}
},
{
"id":11,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
}
},
{
"id":12,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
}
},
{
"id":13,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
}
},
{
"id":15,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
}
},
{
"id":19,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
}
},
{
"id":20,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
}
},
{
"id":21,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
}
},
{
"id":28,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
}
},
{
"id":43,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":2,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
},
{
"height":14.2813,
"id":3,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":14.4375,
"x":0.96875,
"y":0.875
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
}
},
{
"id":44,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
}
},
{
"id":45,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
}
}],
"tilewidth":16,
"type":"tileset",
"version":"1.8"
}

44
assets/maps/testmap Normal file

File diff suppressed because one or more lines are too long

48
assets/maps/testmap.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{"requests": [{"kind": "codemodel", "version": 2}, {"kind": "cmakeFiles", "version": 1}]}

BIN
build/.ninja_deps Normal file

Binary file not shown.

66
build/.ninja_log Normal file
View File

@ -0,0 +1,66 @@
# ninja log v5
5 1257 1680995986388821260 CMakeFiles/BeagleRescue.dir/src/ecs/ECS.cpp.o 2b68ee632af548aa
4 4614 1680995989752187549 CMakeFiles/BeagleRescue.dir/src/assetmgr/AssetManager.cpp.o eb4c2e382e340f10
4 68 1666035599307923948 libtmx-parser/liblibtmxparser.a 4a03bfde239caf5d
1829 5506 1680995990645529632 CMakeFiles/BeagleRescue.dir/src/ui/UIText.cpp.o 2e1a08cbe2ad039c
5 803 1665858094321634764 CMakeFiles/BeagleRescue.dir/libtmx-parser/src/base64.cpp.o 4bbee0e045ced8b2
8176 8273 1680995073021895354 libtmx-parser/liblibtmxparser.so 9df69ecfe8aa882a
3771 6588 1680995071338547771 libtmx-parser/CMakeFiles/libtmxparser.dir/libs/tinyxml2/tinyxml2.cpp.o 96043e32043d331c
13 8224 1680995993362222899 CMakeFiles/BeagleRescue.dir/src/game/Game.cpp.o 4ba02c1268a57ad0
5 3446 1665858096961659219 CMakeFiles/BeagleRescue.dir/libtmx-parser/src/tmxparser.cpp.o 15f574a728100366
4 1896 1680995987032160899 CMakeFiles/BeagleRescue.dir/src/cjson/cJSON.c.o 77f7fe5671dba050
5 4075 1680995989215515625 CMakeFiles/BeagleRescue.dir/src/assetmgr/TextureManager.cpp.o 811f88fdfc09263c
6990 7109 1680995071858552173 libtmx-parser/libs/tinyxml2/xmltest c7f1f4ebf26757c2
4036 6875 1680995071625216864 libtmx-parser/libs/tinyxml2/CMakeFiles/tinyxml2.dir/tinyxml2.cpp.o 660491a0c7495e62
1258 5876 1680995991015533256 CMakeFiles/BeagleRescue.dir/src/ui/UINineSlice.cpp.o 203c7ee19411f630
2059 8176 1680995072928561230 libtmx-parser/CMakeFiles/libtmxparser.dir/src/tmxparser.cpp.o ead5f95e0e72b1e0
4 794 1665858094311634671 CMakeFiles/BeagleRescue.dir/libtmx-parser/libs/tinyxml2/xmltest.cpp.o ee2e170a3bac274c
6978 6990 1680995071728551073 libtmx-parser/libs/tinyxml2/libtinyxml2.so d0fad9500a04c852
4 1088 1665858094604970721 CMakeFiles/BeagleRescue.dir/libtmx-parser/main.cpp.o 86331d80cf701d8d
13 638 1680995985768815183 CMakeFiles/BeagleRescue.dir/src/game/GameStateManager.cpp.o e18efa52ba3b4829
638 874 1680995986008817536 CMakeFiles/BeagleRescue.dir/src/game/StateMachine.cpp.o c995c41f2f407d79
5 3575 1680995988715510727 CMakeFiles/BeagleRescue.dir/src/assetmgr/MusicManager.cpp.o 743e525b8bc7e022
874 1829 1680995986968826945 CMakeFiles/BeagleRescue.dir/src/game/Vector2D.cpp.o d6bbbe0fad885aeb
6978 6990 1680995071728551073 libtmx-parser/libs/tinyxml2/libtinyxml2.so.2 d0fad9500a04c852
5127 6527 1680995071278547263 libtmx-parser/libs/tinyxml2/CMakeFiles/xmltest.dir/xmltest.cpp.o 88e42020838dcd8e
2957 4036 1680995068778526099 libtmx-parser/CMakeFiles/libtmxparser.dir/src/base64.cpp.o e84a5ef1b712902d
9777 9902 1680995074651909151 BeagleRescue e5cb768adc438473
4 4132 1680995989272182847 CMakeFiles/BeagleRescue.dir/src/assetmgr/GameObject.cpp.o ced4d92dc065c0bf
2 730 1681062043486327943 build.ninja bd959f8df49bfbdd
6 3453 1680995988588842819 CMakeFiles/BeagleRescue.dir/src/game/Collision.cpp.o d59bce856486c23e
6875 6978 1680995071728551073 libtmx-parser/libs/tinyxml2/libtinyxml2.so.2.2.0 8aed3caeabaa38d5
20 4401 1680995989538852126 CMakeFiles/BeagleRescue.dir/src/game/Main.cpp.o c1352eaae73a833f
4 2192 1665858095708314276 CMakeFiles/BeagleRescue.dir/libtmx-parser/libs/tinyxml2/tinyxml2.cpp.o 60acd5a4117a4833
4 2488 1681062059289774035 CMakeFiles/BeagleRescue.dir/src/assetmgr/MusicManager.cpp.o 743e525b8bc7e022
4 2608 1681062059413108248 CMakeFiles/BeagleRescue.dir/src/assetmgr/TextureManager.cpp.o 811f88fdfc09263c
4 2703 1681062059509775604 CMakeFiles/BeagleRescue.dir/src/game/Collision.cpp.o d59bce856486c23e
3 2706 1681062059513108961 CMakeFiles/BeagleRescue.dir/src/assetmgr/GameObject.cpp.o ced4d92dc065c0bf
5 2815 1681062059623109746 CMakeFiles/BeagleRescue.dir/src/game/Main.cpp.o c1352eaae73a833f
5 2962 1681062059769777459 CMakeFiles/BeagleRescue.dir/src/ui/UIText.cpp.o 2e1a08cbe2ad039c
5 3207 1681062060013112528 CMakeFiles/BeagleRescue.dir/src/ui/UINineSlice.cpp.o 203c7ee19411f630
3 3347 1681062060153113527 CMakeFiles/BeagleRescue.dir/src/assetmgr/AssetManager.cpp.o eb4c2e382e340f10
5 4194 1681062060999786234 CMakeFiles/BeagleRescue.dir/src/game/Game.cpp.o 4ba02c1268a57ad0
4194 4286 1681062061093120232 BeagleRescue e58e98489844e561
6 591 1681062457555937468 CMakeFiles/BeagleRescue.dir/src/game/GameStateManager.cpp.o e18efa52ba3b4829
591 742 1681062457719271959 CMakeFiles/BeagleRescue.dir/src/game/StateMachine.cpp.o c995c41f2f407d79
5 1761 1681062458725945758 CMakeFiles/BeagleRescue.dir/src/ecs/ECS.cpp.o 2b68ee632af548aa
3 1777 1681062458739279185 CMakeFiles/BeagleRescue.dir/src/cjson/cJSON.c.o 77f7fe5671dba050
742 1911 1681062458882613534 CMakeFiles/BeagleRescue.dir/src/game/Vector2D.cpp.o d6bbbe0fad885aeb
4 2480 1681062459459284286 CMakeFiles/BeagleRescue.dir/src/assetmgr/TextureManager.cpp.o 811f88fdfc09263c
4 2628 1681062459609285349 CMakeFiles/BeagleRescue.dir/src/assetmgr/MusicManager.cpp.o 743e525b8bc7e022
4 2658 1681062459635952204 CMakeFiles/BeagleRescue.dir/src/assetmgr/GameObject.cpp.o ced4d92dc065c0bf
5 2882 1681062459862620477 CMakeFiles/BeagleRescue.dir/src/game/Collision.cpp.o d59bce856486c23e
13 3065 1681062460045955109 CMakeFiles/BeagleRescue.dir/src/game/Main.cpp.o c1352eaae73a833f
3 3323 1681062460302623594 CMakeFiles/BeagleRescue.dir/src/assetmgr/AssetManager.cpp.o eb4c2e382e340f10
1777 4185 1681062461165963044 CMakeFiles/BeagleRescue.dir/src/ui/UIText.cpp.o 2e1a08cbe2ad039c
1761 4194 1681062461172629758 CMakeFiles/BeagleRescue.dir/src/ui/UINineSlice.cpp.o 203c7ee19411f630
5 4476 1681062461455965099 CMakeFiles/BeagleRescue.dir/src/game/Game.cpp.o 4ba02c1268a57ad0
4476 4568 1681062461545965736 BeagleRescue e58e98489844e561
6 3541 1689099824178728855 CMakeFiles/BeagleRescue.dir/src/assetmgr/GameObject.cpp.o ced4d92dc065c0bf
7 3541 1689099824178728855 CMakeFiles/BeagleRescue.dir/src/assetmgr/TextureManager.cpp.o 811f88fdfc09263c
7 3604 1689099824242062276 CMakeFiles/BeagleRescue.dir/src/assetmgr/MusicManager.cpp.o 743e525b8bc7e022
8 3817 1689099824455395905 CMakeFiles/BeagleRescue.dir/src/game/Main.cpp.o c1352eaae73a833f
7 3968 1689099824605396113 CMakeFiles/BeagleRescue.dir/src/game/Collision.cpp.o d59bce856486c23e
14 4213 1689099824852063121 CMakeFiles/BeagleRescue.dir/src/ui/UIText.cpp.o 2e1a08cbe2ad039c
6 4495 1689099825135396846 CMakeFiles/BeagleRescue.dir/src/assetmgr/AssetManager.cpp.o eb4c2e382e340f10
9 4558 1689099825195396929 CMakeFiles/BeagleRescue.dir/src/ui/UINineSlice.cpp.o 203c7ee19411f630

Submodule libtmx-parser deleted from a2b8ca09ef

View File

@ -6,7 +6,7 @@
*/
#include "MusicManager.h"
#include "SDL2/SDL_mixer.h"
#include <SDL2/SDL_mixer.h>
Mix_Music* MusicManager::LoadMusic(const char* path){
Mix_Music* music = Mix_LoadMUS(path);

View File

@ -9,7 +9,7 @@
#define SRC_MUSICMANAGER_H_
#include "../game/Game.hpp"
#include "../../libsdl2_mixer/SDL_mixer.h"
#include <SDL2/SDL_mixer.h>
class MusicManager
{

View File

@ -1,7 +1,7 @@
{
"GameName":"Beagle Rescue",
"WindowName":"Beagle Rescue",
"WindowSize":{"w":320,"h":240},
"WindowSize":{"w":427,"h":240},
"WindowFullScreen": 0,
"GlobalScale": 3
"GlobalScale": 2
}

View File

@ -1,6 +1,6 @@
{
"GameName":"Beagle Rescue",
"Developers": "Alan Youngblood, Simon Zaleski, Daniel Rinaldi",
"LibraryDevelopers": "Sam Lantinga, Dave Gamble, Carl Birch, Job Vranish, David Lafreniere, Bayle Jonathan",
"LibraryDevelopers": "Sam Lantinga, Dave Gamble, Carl Birch, Job Vranish, David Lafreniere, Bayle Jonathan, Robin Berg Pettersen",
"SpecialThanks":"Nic Allen, Brian Lhota, Rodrigo Monteiro"
}

View File

@ -9,7 +9,7 @@
#define SRC_ECS_COLLIDERCOMPONENT_H_
#include <string>
#include "SDL2/SDL.h"
#include <SDL2/SDL.h>
#include "Components.h"
#include "ECS.h"
#include "../assetmgr/TextureManager.h"

View File

@ -70,6 +70,13 @@ public:
break;
case SDLK_LEFT:
if(Game::gsm->currentState == GameStateManager::ST_COREGAME){
if(transform->position.x>Game::levelMap.x){
transform->velocity.x = -1;
// if(Game::playerIsGrounded){
sprite->Play("Walk");
// }
sprite->spriteFlip = SDL_FLIP_NONE;
}
// if (playerCtrl == NULL){
// printf("No player controller found\n");
// } else {
@ -81,7 +88,7 @@ public:
// Game::pTileX
// if(transform->position.x>0){
int *borders;
/*int *borders;
borders = Game::predictCollisions();
float max = borders[0];
for (int b=0;b<3;b++){
@ -102,7 +109,7 @@ public:
transform->velocity.x = 0;
sprite->Play("Idle");
sprite->spriteFlip = SDL_FLIP_NONE;
}
}*/
}
break;
case SDLK_RIGHT:

View File

@ -9,7 +9,7 @@
#define SRC_ECS_SPRITECOMPONENT_H_
#include "Components.h"
#include "SDL2/SDL.h"
#include <SDL2/SDL.h>
#include "../assetmgr/TextureManager.h"
#include "Animation.h"
#include <map>

View File

@ -9,7 +9,7 @@
#define SRC_ECS_TILECOMPONENT_H_
#include "ECS.h"
#include "SDL2/SDL.h"
#include <SDL2/SDL.h>
#include "../assetmgr/AssetManager.h"
class TileComponent : public Component

View File

@ -1,4 +1,5 @@
/*
*
* TileMapComponent.h
*
* Created on: Mar 21, 2020
@ -9,20 +10,21 @@
#define SRC_ECS_TILEMAPCOMPONENT_H_
#include "ECS.h"
#include "../../libsdl2/include/SDL.h"
#include <SDL2/SDL.h>
#include "../assetmgr/AssetManager.h"
#include <fstream>
#include <iostream>
#include <string>
#include <tuple>
#include "tmxparser.h"
#include "../tileson/tileson.hpp"
class TileMapComponent : public Component
{
public:
SDL_Texture* texture;
SDL_Rect srcRect, destRect;
tmxparser::TmxMap map;
tson::Tileson t;
std::unique_ptr<tson::Map> map;
int globalScale;
std::vector<SDL_Rect> tileSet;
std::vector<SDL_Rect> destRects;
@ -40,53 +42,78 @@ public:
SDL_DestroyTexture(texture);
}
TileMapComponent(tmxparser::TmxMap loadedMap, int gScale, int offsetX, int offsetY)
TileMapComponent(std::string mapPath, int gScale, int offsetX, int offsetY)
{
map = loadedMap;
std::string texturePath = "assets/textures/tiles/" + loadedMap.tilesetCollection[0].name + ".png";
Game::assets->AddTexture(map.tilesetCollection[0].name, texturePath.c_str());
setTex(map.tilesetCollection[0].name);
globalScale = gScale;
colliders.resize(map.height, std::vector<int>(map.width, 0));
tilesWide = map.width;
tilesHigh = map.height;
tileWidth = map.tileWidth;
// =========== Setup Tile Set ===========
tileSetTotal = map.tilesetCollection[0].colCount*map.tilesetCollection[0].rowCount;
tileSet.resize(tileSetTotal);
// TILESON ~~~~~~~~~~~
for (int r=0;r<map.tilesetCollection[0].rowCount;r++){
for (int c=0;c<map.tilesetCollection[0].colCount;c++){
srcRect.x = c*map.tilesetCollection[0].tileWidth;
srcRect.y = r*map.tilesetCollection[0].tileHeight;
srcRect.w = srcRect.h = map.tileWidth;
int element = r*map.tilesetCollection[0].colCount+c;
tileSet[element] = srcRect;
const std::filesystem::path jsonPath = std::filesystem::u8path(mapPath);
map = t.parse(jsonPath);
if(map->getStatus() == tson::ParseStatus::OK)
{
tson::Tileset *tileset = map->getTileset("br-tiles");
std::string fullPath = tileset->getImage();
size_t charPos = fullPath.find("assets");
fullPath.erase(0,charPos);
tson::Layer *tileLayer = map->getLayer("Tile Layer 1"); //This is a Layer
std::string texName = tileLayer->getName();
Game::assets->AddTexture(texName, fullPath.c_str());
setTex(texName);
globalScale = gScale;
tson::Layer *collisionLayer = map->getLayer("Collision");
tilesWide = map->getSize().x;
tilesHigh = map->getSize().y;
tileWidth = map->getTileSize().x;
Game::levelMap.w = tilesWide*tileWidth*globalScale;
Game::levelMap.h = tilesHigh*tileWidth*globalScale;
// =========== Setup Tile Set ===========
tileSetTotal = tileset->getTileCount();
tileSet.resize(tileSetTotal);
int tileSetCols = tileset->getColumns();
int tileSetRows = tileSetTotal/tileSetCols;
for (int r=0;r<tileSetRows;r++){
for (int c=0;c<tileSetCols;c++){
srcRect.x = c*tileWidth;
srcRect.y = r*tileWidth;
srcRect.w = srcRect.h = tileWidth;
int element = r*tileSetCols+c;
tileSet[element] = srcRect;
}
}
}
// =========== Setup Tile Map ============
destRects.resize(map.width*map.height);
initialPositions.resize(map.width*map.height);
for (int r = 0;r<map.height;r++){
for (int c = 0;c<map.width;c++){
int elem = c+r*map.width;
SDL_Rect thisRect = SDL_Rect();
thisRect.x = c*map.tilesetCollection[0].tileWidth*globalScale;
thisRect.y = r*map.tilesetCollection[0].tileWidth*globalScale;
thisRect.w = thisRect.h = map.tileWidth * globalScale;
std::tuple<int,int> ogPos = std::make_tuple(thisRect.x,thisRect.y);
initialPositions[elem] = ogPos;
thisRect.x = thisRect.x-offsetX*globalScale;
thisRect.y = thisRect.y-offsetY*globalScale;
destRects[elem] = thisRect;
colliders[r][c] = map.layerCollection[1].tiles[elem].gid;
// std::cout << "colliders[" << std::to_string(r) << "][" << std::to_string(c) << "]= " << std::to_string(colliders[r][c]) << std::endl;
}
}
destRect.w = destRect.h = map.tileWidth * gScale;
if(tileLayer->getType() == tson::LayerType::TileLayer)
{
destRects.resize(tilesWide*tilesHigh);
initialPositions.resize(tilesWide*tilesHigh);
for (int r=0;r<tilesHigh;r++){
for (int c=0;c<tilesWide;c++){
int elem = c+r*tilesWide;
SDL_Rect thisRect = SDL_Rect();
thisRect.x = c*tileWidth*globalScale;
thisRect.y = r*tileWidth*globalScale;
thisRect.w = thisRect.h = tileWidth*globalScale;
std::tuple<int,int> ogPos = std::make_tuple(thisRect.x,thisRect.y);
initialPositions[elem] = ogPos;
thisRect.x = thisRect.x-offsetX*globalScale;
thisRect.y = thisRect.y=offsetY*globalScale;
destRects[elem] = thisRect;
}
}
destRect.w = destRect.h = tileWidth * gScale;
}
} else {
printf("Failed to load Tileson map\n");
std::cout << map->getStatusMessage();
}
}
void update() override
@ -104,15 +131,19 @@ public:
{
//iterate through rows and columns of the map to draw the tiles
// First cycle through rows
for (int r = 0;r<map.height;r++){
tson::Layer *myLayer = map->getLayer("Tile Layer 1");
tson::Layer *collisionLayer = map->getLayer("Collision");
for (int r = 0;r<map->getSize().y;r++){
// Next cycle through each column or tile in that row:
for (int c = 0;c<map.width;c++){
int i = r*map.width+c;
int elem = c+r*map.width;
int tileToDraw = map.layerCollection[0].tiles[i].gid-1;
for (int c = 0;c<map->getSize().x;c++){
int i = r*map->getSize().x+c;
int elem = c+r*map->getSize().x;
tson::Tile *myTile = myLayer->getTileData(c,r);
int tid = myTile->getId()-1;
int tileToDraw = tid;
TextureManager::Draw(texture, tileSet[tileToDraw], destRects[elem], SDL_FLIP_NONE);
if (Game::debugMenu){
if (map.layerCollection[1].tiles[i].gid != 0) {
if (collisionLayer->getTileData(c,r)) {
SDL_SetRenderDrawColor(Game::renderer,255,0,255,134);
SDL_RenderDrawRect(Game::renderer, &destRects[elem]);
}

View File

@ -13,7 +13,7 @@
#define ASCII_ROW_COUNT 16
#include "Components.h"
#include "SDL2/SDL.h"
#include <SDL2/SDL.h>
#include "../assetmgr/TextureManager.h"
#include "../assetmgr/AssetManager.h"
#include <stdio.h>

View File

@ -10,7 +10,7 @@
#include "Game.hpp"
#include "../assetmgr/TextureManager.h"
// #include "../assetmgr/Map.h"
#include "../assetmgr/Map.h"
#include "../ecs/Components.h"
#include "Collision.h"
#include <string>
@ -18,12 +18,13 @@
#include <fstream>
#include <sstream>
#include "../assetmgr/AssetManager.h"
// #include "../ui/UIText.h"
#include "../ui/UIText.h"
#include "../ui/UINineSlice.h"
#include "../cjson/cJSON.h"
#include "../tileson/tileson.hpp"
#include <cmath>
#include <filesystem>
// tmxparser::TmxMap map;
Manager manager;
UINineSlice* my9Slice;
UINineSlice* scoreboard9Slice;
@ -74,6 +75,8 @@ int last_time;
int current_time;
int diff_time;
tson::Tileson t;
int Game::pTileX = 0;
int Game::pTileY = 0;
@ -131,27 +134,6 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g
{
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "Couldn't initialize SDL audio mixer!, Error: %s", SDL_GetError());
}
// Trying out the halsafar/libtmx-parser
tmxparser::TmxReturn error;
tmxparser::TmxMap map;
error = tmxparser::parseFromFile("assets/maps/testmapb64.tmx", &map, "assets/textures/tiles/");
if (!error)
{
// printf("Yay! Tile map loaded with no errors.\n");
tmxparser::TmxLayer layer = map.layerCollection[0];
levelMap.x = 0;
levelMap.y = 0;
levelMap.w = map.width*map.tileWidth*gScale;
levelMap.h = map.height*map.tileHeight*gScale;
// std::cout << "Map Width Tiles: " << map.width << " Map Tile Width: " << map.tileWidth <<std::endl;
} else {
std::cout << "Encountered error loading map file: " << error << std::endl;
}
// std::cout << "levelMap.w - camera.w: " << levelMap.w-camera.w << std::endl;
assets->AddTexture("player", "assets/textures/actors/firefighter.png");
assets->AddTexture("font", "assets/textures/ui/ui-font-cloud-sans.png");
@ -166,7 +148,7 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g
assets->AddSoundClip("bark1","assets/audio/sfx/Bark1.wav");
assets->AddSoundClip("bark2","assets/audio/sfx/Bark2.wav");
// map = new Map("terrain",globalScale,16);
// map = new Map("terrain",globalScale,16);
// std::string myText = "Find lost puppies!\nThey need your help!";
std::string myText = "Press U to Start";
@ -186,7 +168,8 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g
uiInfo.addComponent<TransformComponent>(camera.w/gScale-94,10,72*gScale,96*gScale,gScale);
// uiInfo.addComponent<UITextComponent>("font", "CollisionHori: Vert: Jump: P.y : P.dy: YVec: ", 8, 12, 1);
uiInfo.addComponent<UITextComponent>("font", "Player PTiX: PTiY: P.x: P.y : coll: Px2 bnd ", 8, 12, gScale);
// uiInfo.addComponent<UITextComponent>("font", "Player PTiX: PTiY: P.x: P.y : coll: Px2: tson: ", 8, 12, gScale);
uiInfo.addComponent<UITextComponent>("font", "Player PTiX: PTiY: P.x: P.y : coll: ", 8, 12, gScale);
uiInfo.addGroup(groupUI_Layer3);
uiCamXInfo.addComponent<TransformComponent>(camera.w/gScale-48,23,40*gScale,12*gScale,gScale);
@ -209,13 +192,13 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g
uiBoundary1Info.addComponent<UITextComponent>("font", "nan", 8, 12, gScale);
uiBoundary1Info.addGroup(groupUI_Layer3);
uiBoundary2Info.addComponent<TransformComponent>(camera.w/gScale-64,88,128*gScale,12*gScale,gScale);
uiBoundary2Info.addComponent<UITextComponent>("font", "nan", 8, 12, gScale);
uiBoundary2Info.addGroup(groupUI_Layer3);
uiBoundary3Info.addComponent<TransformComponent>(camera.w/gScale-64,101,128*gScale,12*gScale,gScale);
uiBoundary3Info.addComponent<UITextComponent>("font", "nan", 8, 12, gScale);
uiBoundary3Info.addGroup(groupUI_Layer3);
// uiBoundary2Info.addComponent<TransformComponent>(camera.w/gScale-64,88,128*gScale,12*gScale,gScale);
// uiBoundary2Info.addComponent<UITextComponent>("font", "nan", 8, 12, gScale);
// uiBoundary2Info.addGroup(groupUI_Layer3);
//
// uiBoundary3Info.addComponent<TransformComponent>(camera.w/gScale-64,101,128*gScale,12*gScale,gScale);
// uiBoundary3Info.addComponent<UITextComponent>("font", "nan", 8, 12, gScale);
// uiBoundary3Info.addGroup(groupUI_Layer3);
// debug UI box
SDL_Rect debugBoxRect = SDL_Rect();
@ -237,7 +220,10 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g
player.addComponent<KeyboardController>();
player.addGroup(groupPlayers);
gameScene.addComponent<TileMapComponent>(map,gScale,player.getComponent<TransformComponent>().position.x+player.getComponent<TransformComponent>().width/2,player.getComponent<TransformComponent>().position.y+player.getComponent<TransformComponent>().height/2); //150,100
levelMap.x = 0;
levelMap.y = 0;
gameScene.addComponent<TileMapComponent>("assets/maps/testmap.json",gScale,player.getComponent<TransformComponent>().position.x+player.getComponent<TransformComponent>().width/2,player.getComponent<TransformComponent>().position.y+player.getComponent<TransformComponent>().height/2); //150,100
gameScene.addGroup(groupMap);
playerPosition = Vector2D().Zero();
@ -323,6 +309,8 @@ void Game::update()
}
}
// Gravity
// if (gravityOnPlayer){
@ -358,13 +346,13 @@ void Game::update()
uiPlayerXInfo.getComponent<UITextComponent>().updateString(std::to_string(playerX));
uiPlayerYInfo.getComponent<UITextComponent>().updateString(std::to_string(playerY));
int * foundBoundaries = predictCollisions();
int max = foundBoundaries[0];
for (int b=0;b<3;b++){
if (foundBoundaries[b]>max){
max = foundBoundaries[b];
}
}
// int * foundBoundaries = predictCollisions();
// int max = foundBoundaries[0];
// for (int b=0;b<3;b++){
// if (foundBoundaries[b]>max){
// max = foundBoundaries[b];
// }
// }
float desiredMovementX = -1*player.getComponent<TransformComponent>().speed*0.016;
// int desiredMovementY = player.getComponent<TransformComponent>().velocity.y*player.getComponent<TransformComponent>().speed*player.getComponent<TransformComponent>().scale;
// uiBoundary1Info.getComponent<UITextComponent>().updateString(std::to_string((int)foundBoundaries[0]));
@ -376,8 +364,8 @@ void Game::update()
}
// uiBoundary2Info.getComponent<UITextComponent>().updateString(std::to_string((int)foundBoundaries[1]));
float difference = player.getComponent<TransformComponent>().position.x+desiredMovementX;
uiBoundary2Info.getComponent<UITextComponent>().updateString(std::to_string((float)difference));
uiBoundary3Info.getComponent<UITextComponent>().updateString(std::to_string((int)(max*gScale)));
//uiBoundary2Info.getComponent<UITextComponent>().updateString(std::to_string((float)difference));
//uiBoundary3Info.getComponent<UITextComponent>().updateString(std::to_string((int)(max*gScale)));
// uiBoundary3Info.getComponent<UITextComponent>().updateString(std::to_string((int)foundBoundaries[2]));
@ -492,7 +480,7 @@ void Game::drawLine(Vector2D srcpt, Vector2D destpt, int red, int green, int blu
int * Game::predictCollisions(){
static int boundaries[3];
// ===== LEFT =====
if (player.getComponent<TransformComponent>().velocity.x<0){
/*if (player.getComponent<TransformComponent>().velocity.x<0){
// ====== For Each Row ====
int i = 0;
for (int r=Game::pTileY-1;r<=Game::pTileY+1;r++){
@ -507,7 +495,7 @@ int * Game::predictCollisions(){
}
}
}
}
}*/
/*
// ====== RIGHT ====
if (player.getComponent<TransformComponent>().velocity.x>0){

View File

@ -7,16 +7,18 @@
#ifndef GAME_HPP_
#define GAME_HPP_
#include "../../libsdl2/include/SDL.h"
#include "../../libsdl2_image/SDL_image.h"
#include "../../libsdl2_mixer/SDL_mixer.h"
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_mixer.h>
#include <stdio.h>
#include <iostream>
#include <vector>
#include "Vector2D.h"
#include "../assetmgr/AssetManager.h"
#include "GameStateManager.h"
#include "../../libtmx-parser/src/tmxparser.h"
//#include "../../libtmx-parser/src/tmxparser.h"
//#include "libtmx-parser/src/tmxparser.h"
//#include <tmxparser.h>
class ColliderComponent;
class AssetManager;

8992
src/tileson/tileson.hpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
#ifndef SRC_UININESLICE_H_
#define SRC_UININESLICE_H_
#include "SDL2/SDL.h"
#include <SDL2/SDL.h>
#include "string"
#include "../game/Game.hpp"

View File

@ -12,7 +12,7 @@
#define ASCII_COUNT 96
#define ASCII_ROW_COUNT 16
#include "SDL2/SDL.h"
#include <SDL2/SDL.h>
#include <iostream>
#include "../game/Game.hpp"
#include "../assetmgr/TextureManager.h"