Demo cleanups.

This commit is contained in:
Relintai 2024-01-21 16:09:26 +01:00
parent 5632a084e8
commit 389043ea19
7 changed files with 9 additions and 80 deletions

View File

@ -1,8 +0,0 @@
ccache g++ -Wall -g -c sfw.cpp -o sfw.o
ccache g++ -Wall -g -c main.cpp -o main.o
#-static-libgcc -static-libstdc++
ccache g++ -Wall -lm -ldl -lpthread -lX11 -g sfw.o main.o -o game

View File

@ -1,21 +1,13 @@
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif // __EMSCRIPTEN__
#include "game_application.h"
int main(int argc, char **argv) {
Application *application = memnew(GameApplication());
#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(&Application::main_loop_static, 0, 1);
#else
while (application->running) {
application->main_loop();
}
#endif // __EMSCRIPTEN__
memdelete(application);
return 0;
}

View File

@ -1,47 +0,0 @@
#include "sfw.h"
class GameApplication : public Application {
SFW_OBJECT(GameApplication, Application);
public:
virtual void input_event(const Ref<InputEvent> &event) {}
virtual void update(float delta) {
_font_pos.x += 500 * delta;
if (_font_pos.x > 1800) {
_font_pos.x = 0;
}
}
virtual void render() {
Renderer::get_singleton()->clear_screen(Color());
Renderer::get_singleton()->camera_2d_projection_set_to_window();
Renderer::get_singleton()->draw_text_2d("Test!", _font, _font_pos);
}
GameApplication() {
_font.instance();
_font->load_default(31.5);
_font_pos = Vector2(0, 500);
Renderer::initialize();
}
~GameApplication() {
Renderer::destroy();
}
Vector2 _font_pos;
Ref<Font> _font;
};
int main(int argc, char **argv) {
Application *application = memnew(GameApplication());
while (application->running) {
application->main_loop();
}
memdelete(application);
return 0;
}

View File

@ -1,6 +1,6 @@
cp -u ../out/full/sfw.h sfw.h
cp -u ../out/full/sfw.cpp sfw.cpp
cp -u ../out/full/sfw_3rd.m sfw_3rd.m
cp -u ../tools/merger/out/full/sfw.h sfw.h
cp -u ../tools/merger/out/full/sfw.cpp sfw.cpp
cp -u ../tools/merger/out/full/sfw_3rd.m sfw_3rd.m
ccache g++ -Wall -g -c sfw.cpp -o sfw.o
ccache g++ -Wall -g -c game_scene.cpp -o game_scene.o

View File

@ -2,9 +2,9 @@ rm sfw.h
rm sfw.cpp
rm sfw_3rd.m
cp ../out/full/sfw.h sfw.h
cp ../out/full/sfw.cpp sfw.cpp
cp ../out/full/sfw_3rd.m sfw_3rd.m
cp ../tools/merger/out/full/sfw.h sfw.h
cp ../tools/merger/out/full/sfw.cpp sfw.cpp
cp ../tools/merger/out/full/sfw_3rd.m sfw_3rd.m
export SDKROOT=$(xcrun --show-sdk-path)

View File

@ -1,6 +1,6 @@
cp -u ../out/full/sfw.h sfw.h
cp -u ../out/full/sfw.cpp sfw.cpp
cp -u ../out/full/sfw_3rd.m sfw_3rd.m
cp -u ../tools/merger/out/full/sfw.h sfw.h
cp -u ../tools/merger/out/full/sfw.cpp sfw.cpp
cp -u ../tools/merger/out/full/sfw_3rd.m sfw_3rd.m
ccache g++ -Wall -g -c sfw.cpp -o sfw.o
ccache g++ -Wall -g -c game_scene.cpp -o game_scene.o

View File

@ -1,8 +0,0 @@
ccache g++ -Wall -g -c sfw.cpp -o sfw.o
ccache g++ -Wall -g -c main.cpp -o main.o
#-static-libgcc -static-libstdc++
ccache g++ -Wall -lm -ldl -lpthread -lX11 -g sfw.o main.o -o game