mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 18:00:34 +00:00
hyper-main:: convenience functions for the shared library
This commit is contained in:
parent
cf0d9ac501
commit
a373bad6c7
@ -31,8 +31,10 @@ void moreStack() {
|
|||||||
namespace hr {
|
namespace hr {
|
||||||
EX hookset<bool(int argc, char** argv)> hooks_main;
|
EX hookset<bool(int argc, char** argv)> hooks_main;
|
||||||
|
|
||||||
EX int hyper_main(int argc, char **argv) {
|
EX bool initialized = false;
|
||||||
using namespace hr;
|
|
||||||
|
/** convenience function for libhyper.so: initialize libhyper with given parameters */
|
||||||
|
EX int hyper_init(int argc, char **argv) {
|
||||||
#if ISWEB
|
#if ISWEB
|
||||||
emscripten_get_commandline();
|
emscripten_get_commandline();
|
||||||
#elif ISMOBILE
|
#elif ISMOBILE
|
||||||
@ -53,6 +55,29 @@ EX int hyper_main(int argc, char **argv) {
|
|||||||
arg::read(3);
|
arg::read(3);
|
||||||
start_game();
|
start_game();
|
||||||
#endif
|
#endif
|
||||||
|
initialized = true;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
EX int hyper_init() {
|
||||||
|
return hyper_init(0, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief convenience function for libhyper.so: play the game loop
|
||||||
|
* sample use:
|
||||||
|
* ./mymake -O3 -shared
|
||||||
|
* cling -DFHS -DLINUX -I /usr/include/SDL -l libhyper.so -include hyper.h "-DRun=using namespace hr; hyper_loop();"
|
||||||
|
* Run
|
||||||
|
**/
|
||||||
|
|
||||||
|
EX void hyper_loop() {
|
||||||
|
if(!initialized) hyper_init();
|
||||||
|
quitmainloop = false;
|
||||||
|
mainloop();
|
||||||
|
}
|
||||||
|
|
||||||
|
EX int hyper_main(int argc, char **argv) {
|
||||||
|
if(!hyper_init(argc, argv)) return 0;
|
||||||
#if !ISWEB
|
#if !ISWEB
|
||||||
if(showstartmenu && !vid.skipstart) {
|
if(showstartmenu && !vid.skipstart) {
|
||||||
#if CAP_STARTANIM
|
#if CAP_STARTANIM
|
||||||
|
Loading…
Reference in New Issue
Block a user