Página principal | Jerarquía de la clase | Lista alfabética | Lista de componentes | Lista de archivos | Miembros de las clases | Archivos de los miembros | Páginas relacionadas

jed_evnt.h

Ir a la documentación de este archivo.
00001 //===========================================================================
00002 //= jed_evnt.h                                                Junio de 1998 =
00003 //=-------------------------------------------------------------------------=
00004 //= Definicion del manejo de eventos de teclado y mouse independiente de    =
00005 //= plataforma.                                                             =
00006 //=-------------------------------------------------------------------------=
00007 //= ADVERTENCIA: ESTE SOFTWARE NO ESTA CONCEBIDO NI DISENNADO PARA EL USO   =
00008 //= EN EQUIPO DE CONTROL EN LINEA EN ENTORNOS PELIGROSOS QUE REQUIERAN UN   =
00009 //= DESEMPENNO LIBRE DE FALLAS, COMO LA OPERACION DE PLANTAS NUCLEARES,     = 
00010 //= SISTEMAS DE NAVEGACION O COMUNICACION EN AVIONES, TRAFICO AEREO,        =
00011 //= EQUIPO MEDICO DEL CUAL DEPENDAN VIDAS HUMANAS O SISTEMAS DE ARMAMENTO,  =
00012 //= EN LOS CUALES UNA FALLA EN EL SOFTWARE PUEDA IMPLICAR DIRECTAMENTE LA   =
00013 //= MUERTE, DANNOS PERSONALES O DANNOS FISICOS Y/O AMBIENTALES GRAVES       =
00014 //= ("ACTIVIDADES DE ALGO RIESGO").                                         =
00015 //=-------------------------------------------------------------------------=
00016 //= Autor original: Oscar J. Chavarro G.  A.K.A. JEDILINK. Copyright (c),   =
00017 //= 1997 - 2003, oscarchavarro@hotmail.com                                  =
00018 //= AQUYNZA es software libre, y se rige bajo los terminos de la licencia   =
00019 //= LGPL de GNU (http://www.gnu.org). Para mayor informacion respecto a la  =
00020 //= licencia de uso, consulte el archivo ./doc/LICENCIA en la distribucion. =
00021 //===========================================================================
00022 
00023 #ifndef __JED_EVNT__
00024 #define __JED_EVNT__
00025 #include "jed_defs.h"  // Incluir antes que nada, en ese modulo se definen 
00026                        // aspectos importantes para la portabilidad del sistema
00027 #include "jed_gl.h"
00028 
00029 //===========================================================================
00030 //= Definicion de constantes                                                =
00031 //===========================================================================
00032 
00033 //---------------------------------------------------------------------------
00034 // Posibles eventos
00035 enum ENUM_EVENT_TYPES {
00036     ETYPE_NULL = 0,
00037     ETYPE_KEY_DOWN,
00038     ETYPE_KEY_UP,
00039     ETYPE_BUTTON_DOWN,
00040     ETYPE_BUTTON_UP,
00041     ETYPE_MOUSE_MOVE
00042 };
00043 
00044 // EKEY_MASKS :
00045 #define EKEY_SHIFT 0x00
00046 #define EKEY_CTRL  0x02
00047 #define EKEY_ALT   0x04
00048 
00049 
00050 //---------------------------------------------------------------------------
00051 // JEDILINK KEYS: Identifican tanto teclas como caracteres.  Vea 
00052 // doc/teclado.txt
00053 
00054 // OJO: SOPORTAR LAS TECLAS ESPECIALES DE LAS SUN-SPARC SERIA INTERESANTE 
00055 // PARA JUGAR CON CONTROLES EN ENTORNOS 3D
00056 
00057 
00058 #define JK_VOID                 0xFFFFFF        /* void symbol */
00059 
00060 // TECLAS ESPECIALES
00061 #define JK_SPACE                0x020
00062 #define JK_ENTER                0xFF0D  /* Return, enter */
00063 #define JK_ESC                  0xFF1B
00064 #define JK_TAB                  0xFF09
00065 #define JK_BACKSPACE            0xFF08  /* back space, back char */
00066 #define JK_PAUSE                0xFF13  /* Pause, hold */
00067 
00068 // TECLAS DE CURSOR Y CONTROL DE MOVIMIENTO
00069 #define JK_UP                   0xFF52  // Flechas
00070 #define JK_LEFT                 0xFF51
00071 #define JK_RIGHT                0xFF53
00072 #define JK_DOWN                 0xFF54
00073 #define JK_INSERT               0xFF63  // Las otras
00074 #define JK_DEL                  0xFFFF
00075 #define JK_HOME                 0xFF50
00076 #define JK_END                  0xFF57
00077 #define JK_PAGE_UP              0xFF55
00078 #define JK_PAGE_DOWN            0xFF56
00079 
00080 // TECLAS DE FUNCION
00081 #define JK_F1                   0xFFBE
00082 #define JK_F2                   0xFFBF
00083 #define JK_F3                   0xFFC0
00084 #define JK_F4                   0xFFC1
00085 #define JK_F5                   0xFFC2
00086 #define JK_F6                   0xFFC3
00087 #define JK_F7                   0xFFC4
00088 #define JK_F8                   0xFFC5
00089 #define JK_F9                   0xFFC6
00090 #define JK_F10                  0xFFC7
00091 #define JK_F11                  0xFFC8
00092 #define JK_F12                  0xFFC9
00093 
00094 // TECLAS DE ESTADO
00095 #define JK_SHIFT_L              0xFFE1  /* Left shift */
00096 #define JK_SHIFT_R              0xFFE2  /* Right shift */
00097 #define JK_CONTROL_L            0xFFE3  /* Left control */
00098 #define JK_CONTROL_R            0xFFE4  /* Right control */
00099 #define JK_ALT_L                0xFFE9  /* Left alt */
00100 #define JK_ALT_R                0xFFEA  /* Right alt */
00101 #define JK_CAPS_LOCK            0xFFE5  /* Caps lock */
00102 #define JK_SHIFT_LOCK           0xFFE6  /* Shift lock */
00103 #define JK_META_L               0xFFE7  /* Left meta */
00104 #define JK_META_R               0xFFE8  /* Right meta */
00105 
00106 // TECLAS DEL TECLADO NUMERICO
00107 #define JK_KP_ADD               0xFFAB  // Operadores aritmeticos
00108 #define JK_KP_SUBTRACT          0xFFAD
00109 #define JK_KP_MULTIPLY          0xFFAA
00110 #define JK_KP_DIVIDE            0xFFAF
00111 #define JK_KP_0                 0xFFB0  // Numeros
00112 #define JK_KP_1                 0xFFB1
00113 #define JK_KP_2                 0xFFB2
00114 #define JK_KP_3                 0xFFB3
00115 #define JK_KP_4                 0xFFB4
00116 #define JK_KP_5                 0xFFB5
00117 #define JK_KP_6                 0xFFB6
00118 #define JK_KP_7                 0xFFB7
00119 #define JK_KP_8                 0xFFB8
00120 #define JK_KP_9                 0xFFB9
00121 #define JK_KP_UP                0xFF97  // Flechas
00122 #define JK_KP_LEFT              0xFF96
00123 #define JK_KP_RIGHT             0xFF98
00124 #define JK_KP_DOWN              0xFF99
00125 #define JK_KP_ENTER             0xFF8D  // <ENTER>
00126 #define JK_KP_F1                0xFF91  // PF1, KP_A, ...
00127 #define JK_KP_F2                0xFF92
00128 #define JK_KP_F3                0xFF93
00129 #define JK_KP_F4                0xFF94
00130 #define JK_KP_INSERT            0xFF9E  // Las demas
00131 #define JK_KP_DELETE            0xFF9F
00132 #define JK_KP_HOME              0xFF95
00133 #define JK_KP_END               0xFF9C
00134 #define JK_KP_PAGE_UP           0xFF9A
00135 #define JK_KP_PAGE_DOWN         0xFF9B
00136 #define JK_KP_COMMA             0xFFAC  
00137 #define JK_KP_PUNTO             0xFFAE
00138 
00139 // LETRAS Y NUMEROS DEL TECLADO CONVENCIONAL
00140 #define JK_0                   0x030  // Numeros
00141 #define JK_1                   0x031
00142 #define JK_2                   0x032
00143 #define JK_3                   0x033
00144 #define JK_4                   0x034
00145 #define JK_5                   0x035
00146 #define JK_6                   0x036
00147 #define JK_7                   0x037
00148 #define JK_8                   0x038
00149 #define JK_9                   0x039
00150 #define JK_A                   0x041  // Mayusculas
00151 #define JK_B                   0x042
00152 #define JK_C                   0x043
00153 #define JK_D                   0x044
00154 #define JK_E                   0x045
00155 #define JK_F                   0x046
00156 #define JK_G                   0x047
00157 #define JK_H                   0x048
00158 #define JK_I                   0x049
00159 #define JK_J                   0x04a
00160 #define JK_K                   0x04b
00161 #define JK_L                   0x04c
00162 #define JK_M                   0x04d
00163 #define JK_N                   0x04e
00164 #define JK_O                   0x04f
00165 #define JK_P                   0x050
00166 #define JK_Q                   0x051
00167 #define JK_R                   0x052
00168 #define JK_S                   0x053
00169 #define JK_T                   0x054
00170 #define JK_U                   0x055
00171 #define JK_V                   0x056
00172 #define JK_W                   0x057
00173 #define JK_X                   0x058
00174 #define JK_Y                   0x059
00175 #define JK_Z                   0x05a
00176 #define JK_a                   0x061  // Minusculas
00177 #define JK_b                   0x062
00178 #define JK_c                   0x063
00179 #define JK_d                   0x064
00180 #define JK_e                   0x065
00181 #define JK_f                   0x066
00182 #define JK_g                   0x067
00183 #define JK_h                   0x068
00184 #define JK_i                   0x069
00185 #define JK_j                   0x06a
00186 #define JK_k                   0x06b
00187 #define JK_l                   0x06c
00188 #define JK_m                   0x06d
00189 #define JK_n                   0x06e
00190 #define JK_o                   0x06f
00191 #define JK_p                   0x070
00192 #define JK_q                   0x071
00193 #define JK_r                   0x072
00194 #define JK_s                   0x073
00195 #define JK_t                   0x074
00196 #define JK_u                   0x075
00197 #define JK_v                   0x076
00198 #define JK_w                   0x077
00199 #define JK_x                   0x078
00200 #define JK_y                   0x079
00201 #define JK_z                   0x07a
00202 
00203 // MAMARRACHOS
00204 #define JK_EXCLAM              0x021
00205 #define JK_QUOTEDBL            0x022
00206 #define JK_NUMBERSIGN          0x023
00207 #define JK_DOLLAR              0x024
00208 #define JK_PERCENT             0x025
00209 #define JK_AMPERSAND           0x026
00210 #define JK_APOSTROPHE          0x027
00211 #define JK_QUOTERIGHT          0x027    /* deprecated */
00212 #define JK_PARENLEFT           0x028
00213 #define JK_PARENRIGHT          0x029
00214 #define JK_ASTERISK            0x02a
00215 #define JK_PLUS                0x02b
00216 #define JK_COMMA               0x02c
00217 #define JK_MINUS               0x02d
00218 #define JK_PERIOD              0x02e
00219 #define JK_SLASH               0x02f
00220 #define JK_COLON               0x03a
00221 #define JK_SEMICOLON           0x03b
00222 #define JK_LESS                0x03c
00223 #define JK_EQUAL               0x03d
00224 #define JK_GREATER             0x03e
00225 #define JK_QUESTION            0x03f
00226 #define JK_AT                  0x040
00227 #define JK_BRACKETLEFT         0x05b
00228 #define JK_BACKSLASH           0x05c
00229 #define JK_BRACKETRIGHT        0x05d
00230 #define JK_ASCIICIRCUM         0x05e
00231 #define JK_UNDERSCORE          0x05f
00232 #define JK_GRAVE               0x060
00233 #define JK_QUOTELEFT           0x060    /* deprecated */
00234 #define JK_BRACELEFT           0x07b
00235 #define JK_BAR                 0x07c
00236 #define JK_BRACERIGHT          0x07d
00237 #define JK_ASCIITILDE          0x07e
00238 
00239 // OTRAS
00240 #define JK_SCROLL_LOCK          0xFF14
00241 #define JK_SYS_REQ              0xFF15  // A.k.a. print screen
00242 #define JK_MULTI_KEY            0xFF20  /* Multi-key character compose */
00243 #define JK_SELECT               0xFF60  /* Select, mark */
00244 #define JK_PRINT                0xFF61
00245 #define JK_EXECUTE              0xFF62  /* Execute, run, do */
00246 #define JK_UNDO                 0xFF65  /* Undo, oops */
00247 #define JK_REDO                 0xFF66  /* redo, again */
00248 #define JK_MENU                 0xFF67
00249 #define JK_FIND                 0xFF68  /* Find, search */
00250 #define JK_CANCEL               0xFF69  /* Cancel, stop, abort, exit */
00251 #define JK_HELP                 0xFF6A  /* Help */
00252 #define JK_BREAK                0xFF6B
00253 #define JK_MODE_SWITCH          0xFF7E  /* Character set switch */
00254 #define JK_SCRIPT_SWITCH        0xFF7E  /* Alias for mode_switch */
00255 #define JK_NUM_LOCK             0xFF7F
00256 
00257 //===========================================================================
00258 //= DEFINICION DE CLASES                                                    =
00259 //===========================================================================
00260 
00261 //---------------------------------------------------------------------------
00262 // En el paradigma de programacion orientada a eventos, el usuario ocaciona
00263 // eventos que asincronicamente activan funciones "callback" que lo que hacen
00264 // es cambiar el ESTADO de algunas variables del programa.  La clase 
00265 // EVENTO_GUI almacena el estado de dispositivos de entrada comunes
00266 // (por ahora mouse y teclado) de una manera portable e independiente del
00267 // GUI usado (por ahora se soporta tk/aux de OpenGL)
00268 class EVENTO_GUI {
00269   public:
00270     int modo_de_operacion; // Definido por la aplicacion
00271     int tipo_de_evento;    // Uno de los EVENT_TYPES
00272     int key_code;  // Convertido a uno de los JK (JEDILINK Keys).
00273     int key_mask;  // Una suma de EKEY_MASKS
00274     int mouse_x;   // En coordenadas enteras (pixels) del viewport actual
00275     int mouse_y;
00276     int mouse_old_x;
00277     int mouse_old_y;
00278     int mouse_delta_x;
00279     int mouse_delta_y;
00280     int mouse_button_mask; // El i-esimo boton vale 2^i, y se suman
00281     // Aqui pueden definirse variables para otros dispositivos
00282 
00283     EVENTO_GUI();
00284 };
00285 
00286 extern void Xkeycode2JEDkeycode(EVENTO_GUI *e, unsigned int code);
00287 extern void TKkeycode2JEDkeycode(EVENTO_GUI *e, int code);
00288 extern void GLUTkeycode2JEDkeycode(EVENTO_GUI *e, int code);
00289 extern void GLUTkeycode2JEDkeycodeB(EVENTO_GUI *e, int code);
00290 extern void WXWkeycode2JEDkeycode(EVENTO_GUI *e, int code);
00291 
00292 #if PLATAFORMA == PALM_PALMOS_CODEWARRIOR
00293 extern void Palm2JEDkeycode(EVENTO_GUI *e, EventPtr evento);
00294 #endif
00295 
00296 #ifdef OWL_ENABLED
00297 extern void OWLkeycode2JEDkeycode(EVENTO_GUI *e, WORD code);
00298 #endif
00299 
00300 #ifdef TK_ENABLED
00301 
00302 extern GLenum tk_keyboard_callback(int tecla, GLenum mask);
00303 extern GLenum tk_mouseup_callback(int x, int y, GLenum mask);
00304 extern GLenum tk_mousedown_callback(int x, int y, GLenum mask);
00305 extern GLenum tk_mousemove_callback(int x, int y, GLenum mask);
00306 extern void tk_draw_callback(void);
00307 
00308 #endif
00309 
00310 //===========================================================================
00311 //= Variables globales                                                      =
00312 //===========================================================================
00313 
00314 extern BOOLEAN BUFFER_doble;
00315 extern void (*EVNT_draw_callback)(void);
00316 extern void (*EVNT_resize_callback)(int x_tam, int y_tam);
00317 extern BOOLEAN (*EVNT_keyboard_callback)(EVENTO_GUI *e);
00318 extern BOOLEAN (*EVNT_mouse_callback)(EVENTO_GUI *e);
00319 extern EVENTO_GUI *EVNT_EVENTO_GUI;
00320 
00321 #endif  // __JED_EVNT__
00322 //===========================================================================
00323 //= EOF                                                                     =
00324 //===========================================================================
00325 

Este archivo HTML ha sido generado automáticamente a partir del código fuente AQUYNZA. NO LO EDITE. Para mayor información contacte al autor.