1. Phix and EuSDL2

I'm attempting to bring Musubi by Mark Akita, up to date to use the sdl2 library, and I've run into an odd problem. Apparently there are too many parameters in the call_func/proc

This is the error

D:\EuProgramming\Phix\SDL2\Musubi\EuSDL2.ew:1490 in function SDL_SaveBMP() 
too many parameters in call_func/proc() 
    surf = 48975048 
    fname = `Demo_01.bmp` 
    sptr = 7289584 
    rwops = 48975256 
... called from D:\EuProgramming\Phix\SDL2\Musubi\Musubi2.ew:691 in function M_save_screen() 
    o1 = 1 
    fname = `Demo_01.bmp` 
    surf = 48975048 
... called from D:\EuProgramming\Phix\SDL2\Musubi\Musubi_Demo_01.exw:67 

these are the relevant code snippets

xSDL_SaveBMP_RW = define_c_func(sdl2,"+SDL_SaveBMP_RW",{C_POINTER,C_POINTER,C_INT},C_INT), 
 
public function SDL_SaveBMP(atom surf, sequence fname) 
atom sptr = allocate_string(fname ) 
atom rwops = SDL_RWFromFile(fname,"wb") 
 
    return xSDL_SaveBMP_RW(surf, rwops, 1)   --<--line 1490 
  
    --return xSDL_SaveBMP(surf, fname)      --will never work, routine id is -1 
end function 
 
test=M_save_screen(1,"Demo_01.bmp") 
 
----------------------------------------------------------------------- 
global function M_save_screen(object o1, sequence fname) 
----------------------------------------------------------------------- 
atom surf 
 
surf = SDL_GetWindowSurface(sdlWindow) 
VOID = SDL_SaveBMP(surf, fname) 
 
return VOID 
end function 
 

Any ideas gratefully received.

Cheers

Chris

new topic     » topic index » view message » categorize

2. Re: Phix and EuSDL2

ChrisB said...

too many parameters in call_func/proc() 

xSDL_SaveBMP_RW = define_c_func(sdl2,"+SDL_SaveBMP_RW",{C_POINTER,C_POINTER,C_INT},C_INT), 
 
    return xSDL_SaveBMP_RW(surf, rwops, 1)   --<--line 1490 

It is trying to use xSDL_SaveBMP_RW as a routine_id as opposed to a define_c_func-id.
As of 0.8.1 you can omit a call_func(), but you are trying to omit a c_func(). Instead try:

    return c_func(xSDL_SaveBMP_RW,{surf, rwops, 1}) 
new topic     » goto parent     » topic index » view message » categorize

3. Re: Phix and EuSDL2

Hi Pete Ahhhhh, thanks

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu