mirror of
https://github.com/Relintai/rpi_player.git
synced 2024-11-20 09:17:17 +01:00
Made the sdl module compile. Also the appnow creates a window.
This commit is contained in:
parent
0232f174d1
commit
8a50158e51
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,6 +2,8 @@ engine
|
||||
modules/*
|
||||
logs/*
|
||||
|
||||
*.pyc
|
||||
*.a
|
||||
*.d
|
||||
*.o
|
||||
*.meta
|
||||
|
Binary file not shown.
22
custom_modules/sdl/SCsub
Normal file
22
custom_modules/sdl/SCsub
Normal file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import("env_mod")
|
||||
Import("env")
|
||||
|
||||
env_mod.core_sources = []
|
||||
|
||||
env_mod.add_source_files(env_mod.core_sources, "*.cpp")
|
||||
env_mod.add_source_files(env_mod.core_sources, "core/*.cpp")
|
||||
env_mod.add_source_files(env_mod.core_sources, "renderer/*.cpp")
|
||||
env_mod.add_source_files(env_mod.core_sources, "widgets/*.cpp")
|
||||
|
||||
|
||||
env_mod.Prepend(LINKFLAGS=["-lSDL2_ttf"])
|
||||
env.Prepend(LINKFLAGS=["-lSDL2_ttf"])
|
||||
|
||||
env_mod.Prepend(CPPPATH=["#../custom_modules/sdl"])
|
||||
env.Prepend(CPPPATH=["#../custom_modules/sdl"])
|
||||
|
||||
# Build it all as a library
|
||||
lib = env_mod.add_library("sdl", env_mod.core_sources)
|
||||
env.Prepend(LIBS=[lib])
|
46
custom_modules/sdl/detect.py
Normal file
46
custom_modules/sdl/detect.py
Normal file
@ -0,0 +1,46 @@
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
|
||||
|
||||
def is_active():
|
||||
return True
|
||||
|
||||
|
||||
def get_name():
|
||||
return "sdl2"
|
||||
|
||||
|
||||
def can_build():
|
||||
if os.name == "posix" or sys.platform == "darwin":
|
||||
x11_error = os.system("pkg-config --version > /dev/null")
|
||||
if x11_error:
|
||||
return False
|
||||
|
||||
libevent_err = os.system("pkg-config sdl2 --modversion --silence-errors > /dev/null ")
|
||||
|
||||
if libevent_err:
|
||||
print("sdl2 not found!")
|
||||
return False
|
||||
|
||||
print("sdl2 found!")
|
||||
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def get_opts():
|
||||
return []
|
||||
|
||||
def get_flags():
|
||||
|
||||
return []
|
||||
|
||||
|
||||
def configure(env):
|
||||
env.ParseConfig("pkg-config sdl2 --cflags --libs")
|
||||
|
||||
env.Append(CPPDEFINES=["SDL_PRESENT"])
|
||||
|
||||
|
32
main.cpp
32
main.cpp
@ -2,9 +2,9 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "core/http/web_application.h"
|
||||
#include "core/file_cache.h"
|
||||
#include "core/bry_http/http_server.h"
|
||||
#include "core/file_cache.h"
|
||||
#include "core/http/web_application.h"
|
||||
|
||||
#include "app/ic_application.h"
|
||||
|
||||
@ -16,6 +16,13 @@
|
||||
|
||||
#include "custom_modules/mqtt_server/mqtt_server.h"
|
||||
|
||||
#include <thread>
|
||||
|
||||
#include <SDL_ttf.h>
|
||||
#include "application.h"
|
||||
#include "renderer/renderer.h"
|
||||
#include "impl_application.h"
|
||||
|
||||
#define MAIN_CLASS ICApplication
|
||||
|
||||
void create_databases() {
|
||||
@ -86,18 +93,33 @@ int main(int argc, char **argv) {
|
||||
|
||||
MQTTServer *mqtt_server = new MQTTServer();
|
||||
mqtt_server->initialize();
|
||||
mqtt_server->add_local_session("a/b", [](const std::string &client_id, const std::vector<uint8_t> &data, void* obj){ reinterpret_cast<ICApplication*>(obj)->mqtt_sensor_callback(client_id, data); }, app);
|
||||
mqtt_server->add_local_session(
|
||||
"a/b", [](const std::string &client_id, const std::vector<uint8_t> &data, void *obj) { reinterpret_cast<ICApplication *>(obj)->mqtt_sensor_callback(client_id, data); }, app);
|
||||
|
||||
Renderer *renderer = new Renderer();
|
||||
ImplApplication *sdl_app = new ImplApplication();
|
||||
|
||||
if (!migrate) {
|
||||
printf("Initialized!\n");
|
||||
|
||||
mqtt_server->run_async();
|
||||
server->main_loop();
|
||||
//mqtt_server->run_async();
|
||||
//server->main_loop();
|
||||
|
||||
TTF_Init();
|
||||
|
||||
while (sdl_app->running) {
|
||||
sdl_app->main_loop();
|
||||
}
|
||||
|
||||
TTF_Quit();
|
||||
} else {
|
||||
printf("Running migrations.\n");
|
||||
app->migrate();
|
||||
}
|
||||
|
||||
delete sdl_app;
|
||||
delete renderer;
|
||||
|
||||
delete mqtt_server;
|
||||
delete server;
|
||||
delete app;
|
||||
|
Before Width: | Height: | Size: 792 KiB After Width: | Height: | Size: 792 KiB |
Loading…
Reference in New Issue
Block a user