Recent

Author Topic: SDL problem  (Read 3901 times)

polomint

  • Newbie
  • Posts: 1
SDL problem
« on: October 13, 2010, 01:28:11 pm »
Hi,

Hope that this post is in the correct thread..
I am using Laz/fpc/sdl and have been trying to get the x,y coords of a window.  Using this page for information - http://wiki.delphigl.com/index.php/SDL_SysWMInfo.
For some reason, trying to call lock_func/unlock_func will just not be accepted by the compiler. It is probably something that I am doing wrong but for the life of me I just cannot work it out.

Here is a section of the code in question:
Code: [Select]
 SDL_VERSION(sdlinfo.Version);
  if ( SDL_GetWMInfo(@sdlinfo) > 0 ) then begin
    //C++ converted code here
    //sdlinfo.X11.lock_func();
    {$ASMMODE intel}
    asm
       pushad
       mov eax, sdlinfo.x11.lock_func
       call eax
       popad
       ret
    end;

    display := sdlinfo.X11.display;
    window := sdlinfo.x11.window;
    XSync(display, false);
    XGetWindowAttributes(display, window, @attributes);
    XTranslateCoordinates(display, window, attributes.root, 0, 0, @hX, @hY, @dummy);

    //sdlinfo.X11.unlock_func();
    {$ASMMODE intel}
    asm
       pushad
       mov eax, sdlinfo.x11.unlock_func
       call eax
       popad
       ret
    end;
  end;

Everything else works except for the lock/unlock lines (they just give "Illegal Operation").  Note that they are commented out in the above code because I attempted to use asm to call those functions instead.  Even in asm I get an exception on "call eax".
I have also tried calling them using TProcedure(sdlinfo.X11.lock_func) which causes an exception too.
All the information on the net indicates that it should be "sdlinfo.info.X11.lock_func()"  but then the compiler says that INFO isn't defined..

So,,...  I'm lost.. I would be grateful for any help/hints that anyone has.

This is on Ubuntu 10.04. fpc 2.4.0, Laz 0.9.29 svn 27654

Thanks again.

 

TinyPortal © 2005-2018