Re: [AD] screen == null?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Shawn Hargreaves wrote:
> 
> > I try to use the var out of the DLL but it always runs into an "accessing
> > null" exception.
> 
> That means that you haven't called set_gfx_mode(), or that it failed for
> some reason, in which case you can look in allegro_error to see why.

OK! It works now. The problem was the time of the "linking" to
the screen var. Here's a bit of pseudo code that shows how Delphi accesses
the Allegro library:

[prepare allegro]
   I. find all procs in allxyz.dll by name
  II. call install_allegro(...) with 'DX  '
      (here the screen var points to null!)

[gfx allegro]
   I. set_gfx_mode('DXAC', ...);
  II. win_set_window(DelphiApplication.Handle);
 III. refresh the screen pointer variable 

[draw something]
      draw_sprite(allegro_screen, hero, 0, 0);

[shut down]
      allegro_exit();       


Another _big_ problem is a two-headed one. :) - (:
Delphi, according to its philosophy, manages a lot (better: all!) of
the windows related stuff. (You just add functions to the  windows events)
Therefore, their already exists a registered window class of your program
when you call install_allegro(). The result is that you see _two_ active
programs in the task bar and even worse: calling set_gfx_mode starts 
the black (direct x) screen and you can switch from there to the Delphi
application.

Is it possible to enhance the allegro install routine to merge the allegro
system into an existing thread?

Christian.

P.S.: 
 PLEASE! Tell me about changes of the "layout" in the file allgero.def 
 for the DLL export. Especially if procedure names do change. THANKS.
   


____Christian Stein_______________________________
    Sumpfweg 15       http://www.caladon.de
____72070 Tuebingen___mail:bigstone@domain.hid____



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/