Re: EuTigr Released!

new topic     » goto parent     » topic index » view thread      » older message » newer message

Okay, I got it to work. I had to add some helper functions to Euphoria. You'll also need to use a little different approach to make it work with Euphoria.

--These have been added to the wrapper 
public function tigrRGB(atom r,atom g,atom b) 
	return {r,g,b,#FF} 
end function 
 
public function tigrRGBA(atom r,atom g,atom b,atom a) 
	return {r,g,b,a} 
end function 
 
--use built-in tfont 
 
public atom tfont_var_addr = define_c_var(tigr,"tfont") 
public atom tfont = peek_pointer(tfont_var_addr) 
--example 
include std/ffi.e 
include tigr.e 
 
procedure main() 
 
    -- 1. Enlarge window so (120, 110) fits, or use smaller print coordinates 
    atom screen = tigrWindow(320, 240, "Hello World", TIGR_AUTO) 
     
    -- 2. Include the 4th value (Alpha) in your TPixel sequences 
    sequence colors = {#80, #90, #A0, #FF} 
    sequence font_colors = {#FF, #FF, #00, #FF} -- Bright yellow (R=255, G=255, B=0, A=255) 
     
    while not tigrClosed(screen) and not tigrKeyDown(screen, TK_ESCAPE) do 
     
        tigrClear(screen, colors) 
         
        -- Print inside window bounds (120, 110 fits inside 320x240) 
        tigrPrint(screen, tfont, 120, 110, font_colors, "Hello World", NULL) 
         
        tigrUpdate(screen) 
         
    end while 
     
    tigrFree(screen) 
     
end procedure 
 
main() 
 

I got the openGL example to work

[https://github.com/gAndy50/Misc/tree/master/GL] - I made a simple wrapper for openGL

include std/ffi.e 
include tigr.e 
include openGL.e 
 
atom win = tigrWindow(320,240,"Win",TIGR_AUTO) 
atom win2 = tigrWindow(320,240,"Win 2",TIGR_AUTO) 
 
sequence win_colors = {#80,#90,#A0,#FF} 
 
sequence font_colors = {#FF,#FF,#00,#FF} 
 
while win or win2 do	 
	if win then 
		tigrClear(win,win_colors) 
		tigrPrint(win,tfont,120,110,font_colors,"Hello World",NULL) 
		tigrUpdate(win) 
	 
		if tigrClosed(win) or tigrKeyDown(win,TK_ESCAPE) then 
			tigrFree(win) 
			win = NULL 
		end if 
	end if 
	 
	if win2 then 
		if tigrBeginOpenGL(win2) then 
			glClearColor(1,0,1,0) 
			glClear(GL_COLOR_BUFFER_BIT) 
		end if 
		 
		tigrClear(win2,{0,0,0,0}) 
		tigrPrint(win2,tfont,120,110,font_colors,"Hello World 2",NULL) 
		tigrUpdate(win2) 
		 
		if tigrClosed(win) or tigrKeyDown(win2,TK_ESCAPE) then 
			tigrFree(win2) 
			win2 = NULL 
		end if 
	end if 
end while 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu