Weird Error
- Posted by Icy_Viking in April
- 308 views
Hello all,
So while I was trying to make a simple example using my TTF_Font wrapper with my SDL wrapper. I keep getting bad routine number (1).
Error from err file C:\Euphoria\include\std\ffi.e:1011 in function c_func() c_proc/c_func: bad routine number (1) rid = 1 args = {} 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 = 3 parg = <no value> rtype_size = <no value> prvalue = <no value> rvalue = <no value> i = 5 ... called from C:\Documents\Eu\SDL2\SDL_ttf.e:60 in function TTF_Init() ^Path modified to protect my security
https://github.com/gAndy50/SDL2Wrapper/blob/main/AddOns/SDL_ttf.e - Font Wrapper
include std/ffi.e include sdl.e include SDL_ttf.e if SDL_Init(SDL_INIT_VIDEO) = -1 then puts(1,"Failed to init SDL!\n") abort(0) end if atom win = SDL_CreateWindow("Font Ex",10,10,800,600,SDL_WINDOW_SHOWN) atom ren = SDL_CreateRenderer(win,-1,0) atom x = TTF_Init() --error from this function if x = -1 then puts(1,"Failed to init TTF!\n") abort(0) end if atom font = TTF_OpenFont("arial.ttf",20) atom r = SDL_SetRenderDrawColor(ren,0,0,0,0) atom run = 1 sequence col = {255,0,0,0} atom h = TTF_RenderText_Solid(font,"Hello World",col) atom ht = SDL_CreateTextureFromSurface(ren,h) atom evt = 0 atom evt_type = 0 evt = allocate_struct(SDL_Event) while run = 1 do while SDL_PollEvent(evt) != 0 do evt_type = peek_type(evt,C_UINT32) if evt_type = SDL_QUIT then run = 0 end if end while SDL_RenderClear(ren) SDL_RenderCopy(ren,ht,0,r) SDL_RenderPresent(ren) end while SDL_DestroyRenderer(ren) SDL_DestroyWindow(win) TTF_CloseFont(font) TTF_Quit() SDL_Quit()