1. EuTigr Released!
- Posted by Icy_Viking Jul 29, 2024
- 1247 views
Hi all,
I've finished my wrapper of the TIGR library for Euphoria. Note you'll need to use the 64-bit version of Euphoria to run it.
Grab it from here: https://github.com/gAndy50/EuTigr
include tigr.e procedure main() atom screen = tigrWindow(100,100,"Hello World - Use arrow keys to change background color",TIGR_AUTO) sequence colors = {0,0,0} while not tigrClosed(screen) and not tigrKeyDown(screen,TK_ESCAPE) do if tigrKeyDown(screen,TK_LEFT) then colors = {255,0,0} elsif tigrKeyDown(screen,TK_RIGHT) then colors = {0,255,0} elsif tigrKeyDown(screen,TK_UP) then colors = {0,0,255} elsif tigrKeyDown(screen,TK_DOWN) then colors = {0,0,0} end if tigrClear(screen,colors) tigrUpdate(screen) end while tigrFree(screen) end procedure
2. Re: EuTigr Released!
- Posted by ghaberek (admin) Jul 30, 2024
- 1260 views
Note you'll need to use the 64-bit version of Euphoria to run it.
We can fix that with a few changes to our Makefile.
CFLAGS += -Os -s LDFLAGS += -shared TARGET = $(LIBPRE)tigr$(LIBEXT) ifeq ($(OS),Windows_NT) CFLAGS += -DTIGR_SHARED LDLIBS += -lopengl32 -lgdi32 LIBEXT := .dll else CFLAGS += -fPIC LIBPRE := lib UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Darwin) LDLIBS += -framework OpenGL -framework Cocoa LIBEXT := .dylib else LDLIBS += -lGLU -lGL -lX11 LIBEXT := .so endif endif $(TARGET): tigr.c gcc $(CFLAGS) -DTIGR_BUILDSHARED $(LDFLAGS) -o $@ $< $(LDLIBS)
Now you can do this to create a separate 32-bit DLL:
mingw32-make CFLAGS=-m32 TARGET=tigr32.dll
And even a separate 64-bit DLL if you want:
mingw32-make CFLAGS=-m64 TARGET=tigr64.dll
Note: This only works on Windows with TDM-GCC-64 since it supports both architectures.
include tigr.e procedure main() atom screen = tigrWindow(100,100,"Hello World - Use arrow keys to change background color",TIGR_AUTO) sequence colors = {0,0,0} while not tigrClosed(screen) and not tigrKeyDown(screen,TK_ESCAPE) do if tigrKeyDown(screen,TK_LEFT) then colors = {255,0,0} elsif tigrKeyDown(screen,TK_RIGHT) then colors = {0,255,0} elsif tigrKeyDown(screen,TK_UP) then colors = {0,0,255} elsif tigrKeyDown(screen,TK_DOWN) then colors = {0,0,0} end if tigrClear(screen,colors) tigrUpdate(screen) end while tigrFree(screen) end procedure
What's
-Greg
3. Re: EuTigr Released!
- Posted by Icy_Viking Jul 30, 2024
- 1208 views
Note you'll need to use the 64-bit version of Euphoria to run it.
We can fix that with a few changes to our Makefile.
CFLAGS += -Os -s LDFLAGS += -shared TARGET = $(LIBPRE)tigr$(LIBEXT) ifeq ($(OS),Windows_NT) CFLAGS += -DTIGR_SHARED LDLIBS += -lopengl32 -lgdi32 LIBEXT := .dll else CFLAGS += -fPIC LIBPRE := lib UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Darwin) LDLIBS += -framework OpenGL -framework Cocoa LIBEXT := .dylib else LDLIBS += -lGLU -lGL -lX11 LIBEXT := .so endif endif $(TARGET): tigr.c gcc $(CFLAGS) -DTIGR_BUILDSHARED $(LDFLAGS) -o $@ $< $(LDLIBS)
Now you can do this to create a separate 32-bit DLL:
mingw32-make CFLAGS=-m32 TARGET=tigr32.dll
And even a separate 64-bit DLL if you want:
mingw32-make CFLAGS=-m64 TARGET=tigr64.dll
Note: This only works on Windows with TDM-GCC-64 since it supports both architectures.
include tigr.e procedure main() atom screen = tigrWindow(100,100,"Hello World - Use arrow keys to change background color",TIGR_AUTO) sequence colors = {0,0,0} while not tigrClosed(screen) and not tigrKeyDown(screen,TK_ESCAPE) do if tigrKeyDown(screen,TK_LEFT) then colors = {255,0,0} elsif tigrKeyDown(screen,TK_RIGHT) then colors = {0,255,0} elsif tigrKeyDown(screen,TK_UP) then colors = {0,0,255} elsif tigrKeyDown(screen,TK_DOWN) then colors = {0,0,0} end if tigrClear(screen,colors) tigrUpdate(screen) end while tigrFree(screen) end procedure
What's
-Greg
Thanks Greg. I made the indents so the code would be eaiser to read.
4. Re: EuTigr Released!
- Posted by jmduro 3 days ago
- 114 views
I wanted to play with EuTigr with following example:
include tigr.e procedure main() atom screen = tigrWindow(320, 240, "Hello", 0) atom bitmap = tigrLoadImage("9x18.png") atom tfont = tigrLoadFont(bitmap,TCP_ASCII) while not tigrClosed(screen) and not tigrKeyDown(screen,TK_ESCAPE) do tigrClear(screen, {#00, #00, #00}) tigrPrint(screen, tfont, 120, 110, {#F0, #F0, #F0}, "Hello, world.", 0) tigrUpdate(screen) end while tigrFreeFont(tfont) tigrFree(screen) end procedure main()
No text appears in the window as expected with tigrPrint.
Jean-Marc
5. Re: EuTigr Released!
- Posted by jmduro 3 days ago
- 126 views
The font was built with tigrFront from one of these: https://github.com/IT-Studio-Rech/bdf-fonts
6. Re: EuTigr Released!
- Posted by jmduro 3 days ago
- 126 views
This doesn't work either:
tigrPrint(screen, tfont, 120, 110, {#F0, #F0, #F0}, "%s", allocate_string("Hello, world."))
7. Re: EuTigr Released!
- Posted by Icy_Viking 2 days ago
- 97 views
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
8. Re: EuTigr Released!
- Posted by jmduro 2 days ago
- 79 views
Thank you Andy, it works now.
There is one remaining problem with tigrWindow.
atom screen = tigrWindow(320, 240, "Hello", 0)
The real size of the window seems to be 1280x1024 instead of 320x240 on my 1920x1200 screen (to be honest it is a 4K screen with reduced resolution), run on Linux Mint Debian Edition x64.
Jean-Marc
9. Re: EuTigr Released!
- Posted by jmduro 2 days ago
- 75 views
On Linux, OpenGL example fails on glClearColor.
/usr/local/euphoria-4.1.0-Linux-x64/include/std/ffi.e:1011 in function c_func()
c_proc/c_func: bad routine number (1)
rid = 1
args = {1,0,1,0}
fn = <no value>
cif = <no value>
name = <no value>
nargs = <no value>
parg_types = <no value>
rtype = <no value>
pargs = <no value>
pfree = <no value>
arg_types = <no value>
i = 1
parg = <no value>
rtype_size = <no value>
prvalue = <no value>
rvalue = <no value>
i = 3
... called from /home/duro/Data/Euphoria/v4/EuTigr-main/example/openGL.e:693 in procedure glClearColor()
r = 1
g = 0
b = 1
a = 0
void (from inlined routine 'c_proc' at 20) = <no value>
args (from inlined routine 'c_proc' at 17) = {1,0,1,0}
openGL.e has been modified as here:
ifdef WINDOWS then gl = open_dll("opengl32.dll") elsifdef LINUX then gl = open_dll("libOpenGL.so.0") end ifdef
Jean-Marc
10. Re: EuTigr Released!
- Posted by jmduro 2 days ago
- 75 views
Thank you Andy, it works now.
There is one remaining problem with tigrWindow.
atom screen = tigrWindow(320, 240, "Hello", 0)
The real size of the window seems to be 1280x1024 instead of 320x240 on my 1920x1200 screen (to be honest it is a 4K screen with reduced resolution), run on Linux Mint Debian Edition x64.
Jean-Marc
Oops, sorry! I just noticed this:
--// In TIGR_AUTO mode, the initial window size is set to the bitmap size times the pixel --// scale.
11. Re: EuTigr Released!
- Posted by jmduro 2 days ago
- 76 views
On Linux, OpenGL example fails on glClearColor.
I found the error. There was a space behind +glClearColor:
public constant xglClearColor = define_c_proc(gl,"+glClearColor ",{C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT})
I removed it then it ran.
Jean-Marc
12. Re: EuTigr Released!
- Posted by Icy_Viking 2 days ago
- 65 views
On Linux, OpenGL example fails on glClearColor.
I found the error. There was a space behind +glClearColor:
public constant xglClearColor = define_c_proc(gl,"+glClearColor ",{C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT})
I removed it then it ran.
Jean-Marc
I usually develop on Windows, so I forgot about the linux shared library. I also fixed the space issue before uploading to github. I also got the same error with glClearColor, before I figured out there was a space in the name. Weird that Euphoria is picky about that or maybe its how it reads DLL functions

