Original date:2019-05-15 15:11:47 Edited by: irv Subject: Re: Phix While Loop Inside pGUI Main Loop

I've spent the morning searching the web, and it appears that the best approach to doing this would be by wrapping GLFW3. It's current (most are really old) and has pre-compiled dlls for windows.

OpenGL itself is awfully complex, and there are several Euphoria wrappers for openGL in the archives, if someone wants to use (modify?) those. At any rate, EuGTK just allows you to create a GLArea and obtain an openGL "context". The setup should be simple, see below. As is, this opens a window with a blank black area for drawing. The hard part is writing the openGL code, and about this, like Sergeant Schultz, "I Know Nothing. Nothing!".

include GtkEngine.e 
    win = create(GtkWindow,"size=300x300;border=10;$destroy=Quit"), 
    gla = create(GtkGLArea), 
    glx = get(gla,"context"), 
    clk = create(GIdle,"DoStuff"), --* calls DoStuff repeatedly, as fast as possible; 
    tik = create(GTimeout,250,"Tock") --* calls your "Tock" function 4 times per second; 
 --* = optional, use one or both, as appropriate for the game; 
    connect(gla,"render","Render") -- do whenever needed; 
global function DoStuff() -- fast as possible; 
-- you compute the collisions and moves here, 
-- (and, presumably, call openGL draw function) 
return 1 
end function 
global function Render(atom area, atom context) 
-- redraw the stuff that needs redrawing; 
-- here's where the fun starts (And I Get Lost Totally!) 
return 1 
end function 
global function Tock() -- do something every x milliseconds; 
return 1 -- returning 0 will shut off the tik timer; 
end function 
Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu