Initial commit

This commit is contained in:
2019-07-05 18:24:10 +02:00
commit de53477a49
216 changed files with 2569 additions and 0 deletions

264
.cproject Normal file
View File

@@ -0,0 +1,264 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.432672595">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.432672595" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.432672595" name="Debug" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=" parent="cdt.managedbuild.config.gnu.exe.debug">
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.432672595." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.408213992" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.413774034" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
<builder buildPath="${workspace_loc:/sdl2}/Debug" id="cdt.managedbuild.target.gnu.builder.exe.debug.687007078" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.2066934459" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.345635307" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.259907727" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option defaultValue="gnu.cpp.compiler.debugging.level.max" id="gnu.cpp.compiler.exe.debug.option.debugging.level.1290693487" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.include.paths.1458784280" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="/usr/include/SDL2"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1461608775" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.2038041238" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.1509503307" name="Optimization Level" superClass="gnu.c.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option defaultValue="gnu.c.debugging.level.max" id="gnu.c.compiler.exe.debug.option.debugging.level.191768413" name="Debug Level" superClass="gnu.c.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.170388046" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1102946650" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
<tool commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} `sdl2-config --libs` -lSDL2_image -lSDL2_ttf -lSDL2_mixer -lSDL2_gfx -lm" id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.1257055987" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.link.option.paths.1592898227" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" useByScannerDiscovery="false" valueType="libPaths">
<listOptionValue builtIn="false" value="/usr/include/SDL2"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.link.option.libs.1524523664" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" useByScannerDiscovery="false" valueType="libs">
<listOptionValue builtIn="false" value="SDL2"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.631636323" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.1334813987" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.410094423" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.exe.release.743504276">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.743504276" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.743504276" name="Release" optionalBuildProperties="" parent="cdt.managedbuild.config.gnu.exe.release">
<folderInfo id="cdt.managedbuild.config.gnu.exe.release.743504276." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1679119215" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.1891849865" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
<builder buildPath="${workspace_loc:/sdl2}/Release" id="cdt.managedbuild.target.gnu.builder.exe.release.1420176495" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.996397606" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1908344131" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
<option id="gnu.cpp.compiler.exe.release.option.optimization.level.1991304296" name="Optimization Level" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option defaultValue="gnu.cpp.compiler.debugging.level.none" id="gnu.cpp.compiler.exe.release.option.debugging.level.1557256701" name="Debug Level" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" useByScannerDiscovery="false" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.214645462" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.328939298" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.300917974" name="Optimization Level" superClass="gnu.c.compiler.exe.release.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option defaultValue="gnu.c.debugging.level.none" id="gnu.c.compiler.exe.release.option.debugging.level.1602097190" name="Debug Level" superClass="gnu.c.compiler.exe.release.option.debugging.level" useByScannerDiscovery="false" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.949784426" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.478154787" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.46762233" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1661184587" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.1261346966" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1170961535" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="sdl2.cdt.managedbuild.target.gnu.exe.2125345663" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.432672595;cdt.managedbuild.config.gnu.exe.debug.432672595.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.345635307;cdt.managedbuild.tool.gnu.cpp.compiler.input.1461608775">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.743504276;cdt.managedbuild.config.gnu.exe.release.743504276.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1908344131;cdt.managedbuild.tool.gnu.cpp.compiler.input.214645462">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.432672595;cdt.managedbuild.config.gnu.exe.debug.432672595.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.2038041238;cdt.managedbuild.tool.gnu.c.compiler.input.170388046">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.743504276;cdt.managedbuild.config.gnu.exe.release.743504276.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.328939298;cdt.managedbuild.tool.gnu.c.compiler.input.949784426">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/sdl2"/>
</configuration>
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/sdl2"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>

33
.project Normal file
View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>sdl2</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<variableList>
<variable>
<name>SDL2</name>
<value>file:/usr/include/SDL2</value>
</variable>
</variableList>
</projectDescription>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<configuration id="cdt.managedbuild.config.gnu.exe.debug.432672595" name="Debug">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1017682598503898397" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
<configuration id="cdt.managedbuild.config.gnu.exe.release.743504276" name="Release">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1017682598503898397" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
</project>

View File

@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/SnakeGame.cpp=UTF-8

11
.userdata Normal file
View File

@@ -0,0 +1,11 @@
der Boss;
9305,krasser typ;
660,der Boss;
560,der Boss;
250,dennisgunia;
20,dennisgunia;
0,player;
0,player;
0,player;
0,player;
0,player;

57
AnimatedTexture.cpp Normal file
View File

@@ -0,0 +1,57 @@
/*
* AnimatedTexture.cpp
*
* Created on: Apr 12, 2019
* Author: dennisgunia
*/
#include "AnimatedTexture.h"
void AnimatedTexture::setupAnimatedTexture( std::string file, int frames, SDL_Renderer *render ) {
// TODO Auto-generated constructor stub
this->frames = frames;
this->tx_frames = new FramePointer[frames];
if (frames > 1){
this->animatedSequence = true;
}else{
this->animatedSequence = false;
}
// load textures
for (int i_frame = 0; i_frame < frames ; i_frame++){
std::stringstream tx_filenameStream;
tx_filenameStream << file << "/frame" << i_frame << ".png";
std::string tx_filenameString = tx_filenameStream.str();
char * tx_filename = new char [tx_filenameString.length()+1];
strcpy (tx_filename, tx_filenameString.c_str());
printf("Loading texture : %s \n", tx_filename);
this->tx_frames[i_frame] = IMG_LoadTexture(render, tx_filename);
if (this->tx_frames[i_frame] == NULL ){
printf("[ERROR] Loading texture : %s failed \n", tx_filename);
}
}
}
AnimatedTexture::AnimatedTexture() {
// TODO Auto-generated destructor stub
}
AnimatedTexture::~AnimatedTexture() {
// TODO Auto-generated destructor stub
}
void AnimatedTexture::doAnimationStep(){
this->frame ++;
if(this->frame >= this->frames){
this->frame = 0;
}
};
int AnimatedTexture::getOffset() {
return this->frame;
}
SDL_Texture *AnimatedTexture::getTexture(int offset) {
return this->tx_frames[(offset+(this->frame))%(this->frames)];
}

41
AnimatedTexture.h Normal file
View File

@@ -0,0 +1,41 @@
/*
* AnimatedTexture.h
*
* Created on: Apr 12, 2019
* Author: dennisgunia
*/
#ifndef ANIMATEDTEXTURE_H_
#define ANIMATEDTEXTURE_H_
#include <SDL2/SDL.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>
#include <iostream>
#include <string>
#include <stdio.h>
#include <sstream>
typedef SDL_Texture* FramePointer;
class AnimatedTexture {
private:
bool animatedSequence;
int frames;
int frame;
FramePointer *tx_frames;
public:
AnimatedTexture( );
void setupAnimatedTexture( std::string file, int frames ,SDL_Renderer *render );
void doAnimationStep();
virtual ~AnimatedTexture();
int getOffset();
SDL_Texture *getTexture(int offest);
};
#endif /* ANIMATEDTEXTURE_H_ */

80
AssetLoader.cpp Normal file
View File

@@ -0,0 +1,80 @@
/*
* AssetLoader.cpp
*
* Created on: Apr 13, 2019
* Author: dennisgunia
*/
#include "AssetLoader.hpp"
namespace AssetLoader {
rootPath AL_DefineRootPath(std::string path)
{
return path;
}
TTF_Font *AL_LoadFont(rootPath root,std::string assetName, int fontSize)
{
std::string url = AL_AssetURL(root,assetName);
std::cout << "Load asset @ " << url << "\n";
char * temp = new char [url.length()+1];
strcpy (temp, url.c_str());
TTF_Font *font = TTF_OpenFont(temp, fontSize);
if(!font) {
printf("Cannot load asset @ %s\n", url);
printf("SDL Error: %s\n", TTF_GetError());
}
return font;
}
Mix_Music *AL_LoadMusic(rootPath root,std::string assetName)
{
std::string url = AL_AssetURL(root,assetName);
std::cout << "Load asset @ " << url << "\n";
char * temp = new char [url.length()+1];
strcpy (temp, url.c_str());
Mix_Music *music = Mix_LoadMUS(temp);
if(!music) {
printf("Cannot load asset @ %s\n", url);
printf("SDL Error: %s\n", TTF_GetError());
}
return music;
}
Mix_Chunk *AL_LoadChunk(rootPath root,std::string assetName)
{
std::string url = AL_AssetURL(root,assetName);
std::cout << "Load asset @ " << url << "\n";
char * temp = new char [url.length()+1];
strcpy (temp, url.c_str());
Mix_Chunk *music = Mix_LoadWAV(temp);
if(!music) {
printf("Cannot load asset @ %s\n", url);
printf("SDL Error: %s\n", TTF_GetError());
}
return music;
}
SDL_Texture *AL_LoadTexture(rootPath root,std::string assetName , SDL_Renderer * renderer)
{
std::string url = AL_AssetURL(root,assetName);
std::cout << "Load asset @ " << url << "\n";
char * temp = new char [url.length()+1];
strcpy (temp, url.c_str());
SDL_Texture *tx = IMG_LoadTexture(renderer, temp);
if(!tx) {
printf("Cannot load asset @ %s\n", url);
printf("SDL Error: %s\n", TTF_GetError());
}
return tx;
}
std::string AL_AssetURL(rootPath root,std::string assetName)
{
std::stringstream ss;
ss << root << "/" << assetName;
return ss.str();
}
} /* namespace AssetLoader */

37
AssetLoader.hpp Normal file
View File

@@ -0,0 +1,37 @@
/*
* AssetLoader.hpp
*
* Created on: Apr 13, 2019
* Author: dennisgunia
*/
#ifndef ASSETLOADER_HPP_
#define ASSETLOADER_HPP_
#include <SDL2/SDL.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>
#include <iostream>
#include <string>
#include <stdio.h>
#include <sstream>
namespace AssetLoader {
typedef std::string rootPath;
rootPath AL_DefineRootPath(std::string path);
TTF_Font *AL_LoadFont(rootPath root,std::string assetName, int fontSize);
Mix_Music *AL_LoadMusic(rootPath root,std::string assetName);
SDL_Texture *AL_LoadTexture(rootPath root,std::string assetName , SDL_Renderer * renderer);
Mix_Chunk *AL_LoadChunk(rootPath root,std::string assetName);
std::string AL_AssetURL(rootPath root,std::string assetName);
}
#endif /* ASSETLOADER_HPP_ */

View File

@@ -0,0 +1 @@
,dennisgunia,dennisgunia-MacBookPro,03.11.2018 12:25,file:///home/dennisgunia/.config/libreoffice/4;

Binary file not shown.

BIN
Assets/8bit Stage1 Loop.wav Normal file

Binary file not shown.

BIN
Assets/8bit Stage4 Loop.wav Normal file

Binary file not shown.

BIN
Assets/ARCADECLASSIC.TTF Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
Assets/Death02.wav Normal file

Binary file not shown.

BIN
Assets/Misc01.wav Normal file

Binary file not shown.

BIN
Assets/Misc05.wav Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

4
Assets/coin/.directory Normal file
View File

@@ -0,0 +1,4 @@
[Dolphin]
Timestamp=2019,4,12,17,14,53
Version=4
ViewMode=1

BIN
Assets/coin/frame0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

BIN
Assets/coin/frame1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

BIN
Assets/coin/frame10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

BIN
Assets/coin/frame11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

BIN
Assets/coin/frame12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

BIN
Assets/coin/frame13.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

BIN
Assets/coin/frame2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

BIN
Assets/coin/frame3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

BIN
Assets/coin/frame4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

BIN
Assets/coin/frame5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

BIN
Assets/coin/frame6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

BIN
Assets/coin/frame7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

BIN
Assets/coin/frame8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

BIN
Assets/coin/frame9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

View File

@@ -0,0 +1,4 @@
[Dolphin]
Timestamp=2019,4,12,19,22,35
Version=4
ViewMode=1

BIN
Assets/coinDeath/frame0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

BIN
Assets/coinDeath/frame1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

BIN
Assets/coinDeath/frame2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

BIN
Assets/coinDeath/frame3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

BIN
Assets/coinDeath/frame4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

BIN
Assets/coinDeath/frame5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

BIN
Assets/coinDeath/frame6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

BIN
Assets/coinDeath/frame7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

BIN
Assets/coinDeath/frame8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

BIN
Assets/coinDeath/frame9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

BIN
Assets/earth.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
Assets/moon_surface.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
Assets/music/Title.wav Normal file

Binary file not shown.

BIN
Assets/music/UI03.wav Normal file

Binary file not shown.

BIN
Assets/music/UI04.wav Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

View File

@@ -0,0 +1,4 @@
[Dolphin]
Timestamp=2019,4,12,19,32,53
Version=4
ViewMode=1

BIN
Assets/sparkle/frame0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

BIN
Assets/sparkle/frame1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

BIN
Assets/sparkle/frame10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

BIN
Assets/sparkle/frame11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

BIN
Assets/sparkle/frame12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

BIN
Assets/sparkle/frame13.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

BIN
Assets/sparkle/frame14.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

BIN
Assets/sparkle/frame15.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

BIN
Assets/sparkle/frame16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

BIN
Assets/sparkle/frame17.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

BIN
Assets/sparkle/frame18.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

BIN
Assets/sparkle/frame19.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

BIN
Assets/sparkle/frame2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

BIN
Assets/sparkle/frame20.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
Assets/sparkle/frame21.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
Assets/sparkle/frame22.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
Assets/sparkle/frame23.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
Assets/sparkle/frame24.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
Assets/sparkle/frame25.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
Assets/sparkle/frame26.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
Assets/sparkle/frame27.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
Assets/sparkle/frame28.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
Assets/sparkle/frame29.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
Assets/sparkle/frame3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

BIN
Assets/sparkle/frame30.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
Assets/sparkle/frame31.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
Assets/sparkle/frame32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
Assets/sparkle/frame33.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
Assets/sparkle/frame4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

BIN
Assets/sparkle/frame5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

BIN
Assets/sparkle/frame6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

BIN
Assets/sparkle/frame7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

BIN
Assets/sparkle/frame8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

BIN
Assets/sparkle/frame9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

BIN
Assets/splash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
Assets/splash.xcf Normal file

Binary file not shown.

BIN
Assets/stars.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

3
Debug/AnimatedTexture.d Normal file
View File

@@ -0,0 +1,3 @@
AnimatedTexture.o: ../AnimatedTexture.cpp ../AnimatedTexture.h
../AnimatedTexture.h:

BIN
Debug/AnimatedTexture.o Normal file

Binary file not shown.

3
Debug/AssetLoader.d Normal file
View File

@@ -0,0 +1,3 @@
AssetLoader.o: ../AssetLoader.cpp ../AssetLoader.hpp
../AssetLoader.hpp:

BIN
Debug/AssetLoader.o Normal file

Binary file not shown.

15
Debug/SnakeGame.d Normal file
View File

@@ -0,0 +1,15 @@
SnakeGame.o: ../SnakeGame.cpp ../SnakeGame.hpp ../global.h \
../AssetLoader.hpp ../AnimatedTexture.h ../SnakeTextAnimation.h \
../SnakeTextAnimationHelper.h
../SnakeGame.hpp:
../global.h:
../AssetLoader.hpp:
../AnimatedTexture.h:
../SnakeTextAnimation.h:
../SnakeTextAnimationHelper.h:

Some files were not shown because too many files have changed in this diff Show More