mouse
This commit is contained in:
parent
f987780672
commit
73cdc41e91
|
@ -1,3 +1,8 @@
|
||||||
|
6/10/2002
|
||||||
|
---------
|
||||||
|
* Añadida estructura mouse en la input.dll. Lo malo es que peta al hacer
|
||||||
|
el blit :P supongo que no uso bien fp->Dibuja. (Er_Makina)
|
||||||
|
|
||||||
28/9/2002
|
28/9/2002
|
||||||
---------
|
---------
|
||||||
* El título por defecto de la ventana del juego compilado es el nombre in-
|
* El título por defecto de la ventana del juego compilado es el nombre in-
|
||||||
|
|
11
ediv/bin/test_mouse.prg
Normal file
11
ediv/bin/test_mouse.prg
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
program test_mouse;
|
||||||
|
private
|
||||||
|
mi_mapa;
|
||||||
|
|
||||||
|
begin
|
||||||
|
mi_mapa=load_bmp("hola.bmp");
|
||||||
|
mouse.graph=mi_mapa;
|
||||||
|
loop
|
||||||
|
frame;
|
||||||
|
end
|
||||||
|
end
|
Binary file not shown.
|
@ -1326,7 +1326,7 @@ int eDIV_FADE(FUNCTION_PARAMS2)
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
//*********************************** Entry Points **********************************************//
|
//*********************************** Entry Points **********************************************//
|
||||||
|
|
||||||
FILE * fichero ;
|
FILE * fichero ;
|
||||||
|
@ -1465,6 +1465,7 @@ void frame(FUNCTION_PARAMS)
|
||||||
//if ( last_map >= 2 )
|
//if ( last_map >= 2 )
|
||||||
// Mapa[2]->flags |= SDL_SRCALPHA ;
|
// Mapa[2]->flags |= SDL_SRCALPHA ;
|
||||||
|
|
||||||
|
assert(0);
|
||||||
// Volcamos la pila de bliteos
|
// Volcamos la pila de bliteos
|
||||||
for ( i = 0 ; i <= last_blit ; i++ )
|
for ( i = 0 ; i <= last_blit ; i++ )
|
||||||
{
|
{
|
||||||
|
|
|
@ -143,6 +143,7 @@
|
||||||
|
|
||||||
|
|
||||||
Uint8 *keys ;
|
Uint8 *keys ;
|
||||||
|
Uint8 mbuttons;
|
||||||
|
|
||||||
int SDLtoDIV[1024] ;
|
int SDLtoDIV[1024] ;
|
||||||
|
|
||||||
|
@ -264,6 +265,27 @@ int ExportaFuncs(EXPORTAFUNCS_PARAMS)
|
||||||
_KEY(_c_del) ;
|
_KEY(_c_del) ;
|
||||||
|
|
||||||
FUNCTION("key",1,eDiv_Key) ;
|
FUNCTION("key",1,eDiv_Key) ;
|
||||||
|
|
||||||
|
GLOBAL_STRUCT("mouse",0);
|
||||||
|
_INT("x",0); /* Coordenada x */
|
||||||
|
_INT("y",0); /* Coordenada y */
|
||||||
|
_INT("graph",0); /* Gráfico */
|
||||||
|
_INT("file",0); /* FPG */
|
||||||
|
_INT("z",-512); /* Profundidad (TODO) */
|
||||||
|
_INT("angle",0); /* Ángulo (TODO) */
|
||||||
|
_INT("size",100); /* Tamaño (TODO) */
|
||||||
|
_INT("flags",0); /* Banderas (TODO) */
|
||||||
|
_INT("region",0); /* Región (TODO) */
|
||||||
|
_INT("left",0); /* Botón izquierdo */
|
||||||
|
_INT("middle",0); /* Botón central o de ruedecilla */
|
||||||
|
_INT("right",0); /* Botón derecho */
|
||||||
|
_INT("wheelup",0); /* Ruedecilla arriba (NUEVO) */
|
||||||
|
_INT("wheeldown",0); /* Ruedecilla abajo (NUEVO) */
|
||||||
|
_INT("cursor",0); /* Emulación con teclas de cursor (TODO) */
|
||||||
|
_INT("speed",0); /* Velocidad del ratón (TODO) */
|
||||||
|
_INT("transparency",0); /* Transparencia (NUEVO) (TODO) */
|
||||||
|
END_STRUCT;
|
||||||
|
|
||||||
ENTRYPOINT(first_load) ;
|
ENTRYPOINT(first_load) ;
|
||||||
ENTRYPOINT(frame) ;
|
ENTRYPOINT(frame) ;
|
||||||
|
|
||||||
|
@ -504,9 +526,38 @@ void first_load(FUNCTION_PARAMS)
|
||||||
void frame(FUNCTION_PARAMS)
|
void frame(FUNCTION_PARAMS)
|
||||||
{
|
{
|
||||||
int numkeys ;
|
int numkeys ;
|
||||||
|
int _mouse=globalptr("mouse");
|
||||||
|
SDL_Rect srcrect,dstrect;
|
||||||
|
|
||||||
keys = SDL_GetKeyState(&numkeys ) ;
|
keys = SDL_GetKeyState(&numkeys ) ;
|
||||||
|
|
||||||
|
mbuttons = SDL_GetMouseState(&fp->mem[_mouse],&fp->mem[_mouse+1]);
|
||||||
|
|
||||||
|
/* Ponemos los 5 botones a 0 */
|
||||||
|
memset(&fp->mem[_mouse+9],0,5*4);
|
||||||
|
|
||||||
|
if(mbuttons&SDL_BUTTON(1))
|
||||||
|
fp->mem[_mouse+9]=1;
|
||||||
|
|
||||||
|
if(mbuttons&SDL_BUTTON(2))
|
||||||
|
fp->mem[_mouse+10]=1;
|
||||||
|
|
||||||
|
if(mbuttons&SDL_BUTTON(3))
|
||||||
|
fp->mem[_mouse+11]=1;
|
||||||
|
|
||||||
|
if(mbuttons&SDL_BUTTON(4)) /* podria no funcionar ¿necesario sdl_event? */
|
||||||
|
fp->mem[_mouse+12]=1;
|
||||||
|
|
||||||
|
if(mbuttons&SDL_BUTTON(5)) /* podria no funcionar ¿necesario sdl_event? */
|
||||||
|
fp->mem[_mouse+13]=1;
|
||||||
|
|
||||||
|
srcrect.x=srcrect.y=srcrect.w=srcrect.h=dstrect.w=dstrect.h=0;
|
||||||
|
dstrect.x=fp->mem[_mouse];
|
||||||
|
dstrect.y=fp->mem[_mouse+1];
|
||||||
|
|
||||||
|
// TODO: añadir chequeo de error si no existe file o mapa
|
||||||
|
fp->Dibuja(fp->files[fp->mem[_mouse+3]].mapa[fp->mem[_mouse+2]].Surface,srcrect,dstrect,fp->mem[_mouse+4],0);
|
||||||
|
|
||||||
//FILE* fichero ;
|
//FILE* fichero ;
|
||||||
//fichero = fopen( "input.txt" , "w+" ) ;
|
//fichero = fopen( "input.txt" , "w+" ) ;
|
||||||
//for ( i = 0 ; i < 256 ; i++ )
|
//for ( i = 0 ; i < 256 ; i++ )
|
||||||
|
|
|
@ -326,7 +326,6 @@ void sintactico(void)
|
||||||
hacer_strfix=1;
|
hacer_strfix=1;
|
||||||
optimizar=1;*/
|
optimizar=1;*/
|
||||||
|
|
||||||
printf("** CHECKPOINT 1\n");
|
|
||||||
if(case_sensitive) {
|
if(case_sensitive) {
|
||||||
memcpy(lower+129,"üéâäàåçêëèïîìäåéææôöòûùÿöü¢£¥áíóú",35);
|
memcpy(lower+129,"üéâäàåçêëèïîìäåéææôöòûùÿöü¢£¥áíóú",35);
|
||||||
memcpy(lower+'A',"ABCDEFGHIJKLMNOPQRSTUVWXYZ",26);
|
memcpy(lower+'A',"ABCDEFGHIJKLMNOPQRSTUVWXYZ",26);
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue