mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-21 23:58:51 -05:00
3ab0c45bdb
Closing the window with the X button will not close it immediately during the rendering of a frame, causing it to actually crash, but will set the engine in a pending state until it finishes the current frame.
40 lines
966 B
C++
40 lines
966 B
C++
#include <iostream>
|
|
#include "raylib.h"
|
|
#include "game/game.h"
|
|
#include "impl/fs-bridge/fs-bridge.h"
|
|
#include "impl/fs-bridge/windows/fs-windows.h"
|
|
#include "impl/fs-bridge/linux/fs-linux.h"
|
|
#include "impl.h"
|
|
|
|
using namespace std;
|
|
|
|
FSBridge* NativeFS = nullptr;
|
|
OTRGame* Game = nullptr;
|
|
|
|
void UpdateDrawFrame(void) {
|
|
Game->update();
|
|
Game->draw();
|
|
}
|
|
|
|
int main() {
|
|
constexpr Vector2 windowSize = Vector2(400, 200);
|
|
SetConfigFlags(FLAG_VSYNC_HINT);
|
|
SetConfigFlags(FLAG_WINDOW_HIGHDPI);
|
|
SetConfigFlags(FLAG_WINDOW_UNDECORATED);
|
|
SetConfigFlags(FLAG_MSAA_4X_HINT);
|
|
SetConfigFlags(FLAG_WINDOW_TRANSPARENT);
|
|
InitWindow(windowSize.x, windowSize.y, "");
|
|
#ifdef _WIN32
|
|
NativeFS = new WindowsBridge;
|
|
#else
|
|
NativeFS = new LinuxBridge;
|
|
#endif
|
|
Game = new OTRGame();
|
|
Game->preload();
|
|
Game->init();
|
|
while(!WindowShouldClose() && !Game->CloseRequested()) {
|
|
UpdateDrawFrame();
|
|
}
|
|
CloseWindow();
|
|
return 0;
|
|
} |