Reupload
This commit is contained in:
27
assets/linux/Makefile
Executable file
27
assets/linux/Makefile
Executable file
@ -0,0 +1,27 @@
|
||||
### Sample DamnCute Engine based program Makefile ###
|
||||
|
||||
SRC = src/main.cpp \
|
||||
src/Game.cpp
|
||||
|
||||
NAME = sample
|
||||
CXXFLAGS = -Wall -Wextra -ansi -W -O2 -std=c++0x -I./include
|
||||
CXX = clang++
|
||||
OBJS = $(SRC:.cpp=.o)
|
||||
LINKER = $(CXX)
|
||||
|
||||
LIB = ./libs
|
||||
|
||||
LDFLAGS = -L$(LIB) -Wl,-rpath $(LIB) $(LIB)/*
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
$(NAME): $(OBJS)
|
||||
$(LINKER) $(OBJS) $(LDFLAGS) -o $(NAME)
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS) *.swp *~ *#
|
||||
|
||||
fclean: clean
|
||||
$(RM) $(NAME)
|
||||
|
||||
.PHONY: all clean fclean re
|
1
assets/linux/launcher.sh
Normal file
1
assets/linux/launcher.sh
Normal file
@ -0,0 +1 @@
|
||||
LD_LIBRARY_PATH=./libs ./sample
|
48
assets/mac/Makefile
Normal file
48
assets/mac/Makefile
Normal file
@ -0,0 +1,48 @@
|
||||
### Sample DamnCute Engine based app Makefile ###
|
||||
|
||||
SRC = src/main.cpp \
|
||||
src/Game.cpp
|
||||
|
||||
NAME = sample
|
||||
CXXFLAGS = -Wall -Wextra -ansi -W -O2 -std=c++0x -I./include
|
||||
CXX = clang++
|
||||
OBJS = $(SRC:.cpp=.o)
|
||||
LINKER = $(CXX)
|
||||
|
||||
LIB = ./libs
|
||||
|
||||
define SFML
|
||||
$(LIB)/libsfml-$(1).2.dylib
|
||||
endef
|
||||
|
||||
LIBSFML = $(call SFML,system) $(call SFML,audio) $(call SFML,graphics) $(call SFML,window)
|
||||
LDFLAGS = -std=c++0x -stdlib=libc++ -headerpad_max_install_names $(LIB)/libdamncute.1.dylib $(LIBSFML) -L$(LIB) -Wl,-rpath $(LIB)
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
$(NAME): $(OBJS)
|
||||
$(LINKER) $(OBJS) $(LDFLAGS) -o $(NAME)
|
||||
|
||||
BUNDEST = $(NAME).app/Contents
|
||||
STOPCOL = \x1b[0m
|
||||
GREEN = \x1b[32;01m
|
||||
|
||||
bundle: $(NAME)
|
||||
@mkdir -p $(BUNDEST)/MacOS $(BUNDEST)/Resources
|
||||
@cp -R libs $(BUNDEST)/MacOS
|
||||
@mv $(NAME) $(BUNDEST)/MacOS
|
||||
@cd $(BUNDEST) && ln -s MacOS/libs Frameworks
|
||||
@cd $(BUNDEST) && ln -s MacOS/libs libs
|
||||
@cp -R util/Info.plist $(BUNDEST)
|
||||
@cp -R util/launcher.sh $(BUNDEST)/MacOS
|
||||
@cp -R util/Icon.icns $(BUNDEST)/Resources
|
||||
@echo "Your OS X app bundle was created as $(GREEN)$(NAME).app$(STOPCOL)"
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS) *.swp *~ *#
|
||||
|
||||
fclean: clean
|
||||
@$(RM) -rf $(NAME).app
|
||||
$(RM) $(NAME)
|
||||
|
||||
.PHONY: all clean fclean re
|
BIN
assets/mac/util/Icon.icns
Normal file
BIN
assets/mac/util/Icon.icns
Normal file
Binary file not shown.
26
assets/mac/util/Info.plist
Normal file
26
assets/mac/util/Info.plist
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>launcher.sh</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>Icon</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>© 2013 yourteam</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.yourteam.sample</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>sample</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>Game</string>
|
||||
</dict>
|
||||
</plist>
|
3
assets/mac/util/launcher.sh
Executable file
3
assets/mac/util/launcher.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" ; cd ..
|
||||
MacOS/sample $1 $2
|
BIN
assets/resources/bg.jpg
Normal file
BIN
assets/resources/bg.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 MiB |
33
assets/src/Game.cpp
Normal file
33
assets/src/Game.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include "Game.hpp"
|
||||
|
||||
Game::Game() : AGame("resources/", "bg.jpg") {
|
||||
|
||||
_engine = DamnCute::Core::getInstance();
|
||||
}
|
||||
|
||||
void Game::run() {
|
||||
|
||||
_engine->createWindow();
|
||||
_alive = _engine->getWindowStatus();
|
||||
while (_alive) {
|
||||
update();
|
||||
if (_alive) {
|
||||
_engine->flushEvent();
|
||||
_engine->flushScene();
|
||||
}
|
||||
}
|
||||
_engine->freeAll();
|
||||
}
|
||||
|
||||
void Game::pause() {}
|
||||
|
||||
bool Game::update() {
|
||||
return (DamnCute::Core::getInstance()->getWindowStatus());
|
||||
}
|
||||
|
||||
void Game::playMusic() {
|
||||
|
||||
_engine->musicPath("resources/music");
|
||||
_engine->getMusic().setLoop(true);
|
||||
_engine->musicPlay(0);
|
||||
}
|
23
assets/src/Game.hpp
Normal file
23
assets/src/Game.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef GAME_HPP_
|
||||
# define GAME_HPP_
|
||||
|
||||
#include <damncute/Core/Core.hh>
|
||||
#include <damncute/AGame.hh>
|
||||
|
||||
class Game : public DamnCute::AGame {
|
||||
|
||||
private:
|
||||
bool update();
|
||||
void playMusic();
|
||||
bool _alive;
|
||||
DamnCute::Core *_engine;
|
||||
|
||||
public:
|
||||
Game();
|
||||
~Game() = default;
|
||||
virtual void run();
|
||||
virtual void pause();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
8
assets/src/main.cpp
Normal file
8
assets/src/main.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include "Game.hpp"
|
||||
|
||||
int main(void) {
|
||||
|
||||
Game g;
|
||||
g.run();
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user