Bennu Game Development

Foros en EspaƱol => Mesa de Ayuda => Topic started by: l1nk3rn3l on February 05, 2009, 03:28:25 PM

Title: datos compartidos desde la dll
Post by: l1nk3rn3l on February 05, 2009, 03:28:25 PM
saludos ,

hace tiempo que no pasaba por aqui
estoy haciendo algo interesante, pero
necesito desde la dll recuperar el contenido
de mouse.x y mouse.y intento con glodword("mouse.y")
y me arroja cientos de errores...

que debo hacer?

como recupero datos usando las librerias .h del bennu?

me regalan un ejemplo? de como recuperar los datos usando
las variables globales, o como seria mas eficiente el mouse
sin necesidad de pasarle datos desde el .prg?

Title: Re: datos compartidos desde la dll
Post by: Sandman on February 05, 2009, 03:53:00 PM
You should tell Bennu your library depends on Mouse.X and Mouse.Y by doing:

DLLEXPORT DLVARFIXUP  __bgdexport(mylib,globals_fixup)[]  =   { // variable_numbers:
{ "MOUSE.X"                       , NULL , -1 , -1 }, // 0 = GLOBAL_MOUSE_X
{ "MOUSE.Y"                       , NULL , -1 , -1 }, // 1 = GLOBAL_MOUSE_Y
{ NULL                            , NULL , -1 , -1 }
};
enum {
GLOBAL_MOUSE_X = 0,
GLOBAL_MOUSE_Y
} _globals;

Change mylib to the exact name of your library without extension.

To tell Bennu you rely on libmouse:

DLLEXPORT char * __bgdexport(mylib,modules_dependency)[] = {
"libmouse",
NULL
};

Change mylib to the exact name of your library without extension.

To use it in your library:

GLOINT32( < the_exact_name_of_your_library_without_extension > , < INSTANCE* instance > , < variable_number > )

for example:

INSTANCE* i = first_instance;
int mouse_x = GLOINT32(mylib,i,GLOBAL_MOUSE_X);
GLOINT32(mylib,i,GLOBAL_MOUSE_X) = 0;


See dlvaracc.h for more LOC*() and GLO*() MACROs.
Also take a look at my bennu library template (http://deathegg.student.utwente.nl/files/BennuLib.c).

I think I don't have to translate this to Spanish. :)
Title: Re: datos compartidos desde la dll
Post by: SplinterGU on February 05, 2009, 04:21:30 PM
exacto, tambien podes ver el fuente del mod_mouse.c o libmouse.c en el svn.
ya los fuentes de bennu estan liberados.
Title: Re: datos compartidos desde la dll
Post by: l1nk3rn3l on February 06, 2009, 05:09:43 PM
Thx...

Gracias