Window Appears Briefly Then Disappears
- Posted by Icy_Viking Jul 01, 2019
- 1348 views
Hello all,
I am currently wrapping the RayLib, https://www.raylib.com/index.html, while I don't have all of it wrapped yet, I decided to make a small test program to see if it is working. Right now, the window appears, but goes away quickly. Here is the code
--Wrapper Code public constant xInitWindow = define_c_proc(ray,"InitWindow",{C_INT,C_INT,C_POINTER}), xWindowShouldClose = define_c_func(ray,"WindowShouldClose",{},C_BOOL), xCloseWindow = define_c_proc(ray,"CloseWindow",{}) public procedure InitWindow(atom w,atom h,sequence title) atom str = allocate_string(title,1) c_proc(xInitWindow,{w,h,str}) end procedure public function WindowShouldClose() return c_func(xWindowShouldClose,{}) end function public procedure CloseWindow() c_proc(xCloseWindow,{}) end procedure
--Example Program include std/machine.e include Euraylib.ew atom width = 800, height = 600 InitWindow(width,height,"Basic Win") SetTargetFPS(30) while not WindowShouldClose() do BeginDrawing() ClearBackground(0) EndDrawing() end while CloseWindow()
I know it might be possible, I need to wrap more of the library. The C code below is the example, I am trying to re-create in Euphoria code. Not sure, but this might help with documentation https://www.raylib.com/cheatsheet/cheatsheet.html
#include "raylib.h" int main(void) { // Initialization //-------------------------------------------------------------------------------------- const int screenWidth = 800; const int screenHeight = 450; InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window"); SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- // Main game loop while (!WindowShouldClose()) // Detect window close button or ESC key { // Update //---------------------------------------------------------------------------------- // TODO: Update your variables here //---------------------------------------------------------------------------------- // Draw //---------------------------------------------------------------------------------- BeginDrawing(); ClearBackground(RAYWHITE); DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); EndDrawing(); //---------------------------------------------------------------------------------- } // De-Initialization //-------------------------------------------------------------------------------------- CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- return 0; }