ggi support

This commit is contained in:
Bradley Bell 2001-01-22 15:45:41 +00:00
parent c83e86ffe7
commit 9eb57ce522
7 changed files with 42 additions and 34 deletions

View file

@ -3,6 +3,8 @@
#ifndef _CONSOLE_H_ #ifndef _CONSOLE_H_
#define _CONSOLE_H_ 1 #define _CONSOLE_H_ 1
#include "pstypes.h"
/* Priority levels */ /* Priority levels */
#define CON_CRITICAL -2 #define CON_CRITICAL -2
#define CON_URGENT -1 #define CON_URGENT -1

View file

@ -12,13 +12,16 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/ */
/* /*
* $Source: /cvs/cvsroot/d2x/input/ggi/include/key.h,v $ * $Source: /cvs/cvsroot/d2x/input/ggi/include/key.h,v $
* $Revision: 1.1.1.1 $ * $Revision: 1.2 $
* $Author: bradleyb $ * $Author: bradleyb $
* $Date: 2001-01-19 03:29:59 $ * $Date: 2001-01-22 15:42:15 $
* *
* Header for keyboard functions * Header for keyboard functions
* *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.1.1.1 2001/01/19 03:29:59 bradleyb
* Import of d2x-0.0.8
*
* Revision 1.2 1999/07/10 02:59:06 donut * Revision 1.2 1999/07/10 02:59:06 donut
* more from orulz * more from orulz
* *
@ -114,6 +117,7 @@ extern volatile int keyd_time_when_last_pressed;
// These are the "buffered" keypress routines. Use them by setting the // These are the "buffered" keypress routines. Use them by setting the
// "keyd_buffer_type" variable. // "keyd_buffer_type" variable.
extern void key_putkey (unsigned short); // simulates a keystroke
extern void key_flush(); // Clears the 256 char buffer extern void key_flush(); // Clears the 256 char buffer
extern int key_checkch(); // Returns 1 if a char is waiting extern int key_checkch(); // Returns 1 if a char is waiting
extern int key_getch(); // Gets key if one waiting other waits for one. extern int key_getch(); // Gets key if one waiting other waits for one.

View file

@ -1,6 +1,7 @@
#include <conf.h> #include <conf.h>
#ifdef GGI_INPUT #ifdef GII_INPUT
#include <stdio.h> #include <stdio.h>
#include <sys/time.h> #include <sys/time.h>
#include <ggi/gii.h> #include <ggi/gii.h>
@ -59,10 +60,10 @@ void event_poll()
mouse_handler_relative(event.pmove.x, event.pmove.y); mouse_handler_relative(event.pmove.x, event.pmove.y);
break; break;
case evPtrButtonPress: case evPtrButtonPress:
mouse_handler_button(event.pbutton.button, 1); mouse_handler_button(event.pbutton.button - 1, 1);
break; break;
case evPtrButtonRelease: case evPtrButtonRelease:
mouse_handler_button(event.pbutton.button, 0); mouse_handler_button(event.pbutton.button - 1, 0);
break; break;
} }
} }
@ -70,8 +71,10 @@ void event_poll()
void event_close() void event_close()
{ {
#ifndef GGI_VIDEO
if (inputs) if (inputs)
giiClose(inputs); giiClose(inputs);
#endif
giiExit(); giiExit();
} }
@ -128,4 +131,4 @@ int event_init()
return 0; return 0;
} }
#endif //GGI_INPUT #endif /* GII_INPUT */

View file

@ -1,4 +1,7 @@
#include <conf.h> #include <conf.h>
#ifdef GII_INPUT
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "text.h" #include "text.h"
@ -9,3 +12,5 @@
void arch_ggi_init() void arch_ggi_init()
{ {
} }
#endif /* GII_INPUT */

View file

@ -1,5 +1,7 @@
#include <conf.h> #include <conf.h>
#ifdef GGI_INPUT
#ifdef GII_INPUT
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -47,27 +49,7 @@ typedef struct keyboard {
static /*volatile*/ keyboard key_data; static /*volatile*/ keyboard key_data;
char * key_text[256] = { char * key_text[256];
"","ESC","1","2","3","4","5","6","7","8","9","0","-",
"=","BSPC","TAB","Q","W","E","R","T","Y","U","I","O",
"P","[","]","ƒ","LCTRL","A","S","D","F",
"G","H","J","K","L",";","'","`",
"LSHFT","\\","Z","X","C","V","B","N","M",",",
".","/","RSHFT","PAD*","LALT","SPC",
"CPSLK","F1","F2","F3","F4","F5","F6","F7","F8","F9",
"F10","NMLCK","SCLK","PAD7","PAD8","PAD9","PAD-",
"PAD4","PAD5","PAD6","PAD+","PAD1","PAD2","PAD3","PAD0",
"PAD.","","","","F11","F12","","","","","","","","","",
"","","","","","","","","","","","","","","","","","","","",
"","","","","","","","","","","","","","","","","","","","",
"","","","","","","","","","","","","","","","","","",
"PADƒ","RCTRL","","","","","","","","","","","","","",
"","","","","","","","","","","PAD/","","","RALT","",
"","","","","","","","","","","","","","HOME","","PGUP",
"","<EFBFBD>","","","","END","","PGDN","INS",
"DEL","","","","","","","","","","","","","","","","","",
"","","","","","","","","","","","","","","","","","","","",
"","","","","","","" };
unsigned char ascii_table[128] = unsigned char ascii_table[128] =
{ 255, 255, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=',255,255, { 255, 255, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=',255,255,
@ -495,4 +477,4 @@ unsigned int key_up_count(int scancode)
} }
#endif //GGI_INPUT #endif /* GII_INPUT */

View file

@ -1,5 +1,7 @@
#include <conf.h> #include <conf.h>
#ifdef GGI_INPUT
#ifdef GII_INPUT
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <ggi/gii.h> #include <ggi/gii.h>
@ -158,4 +160,4 @@ int mouse_button_state(int button)
return Mouse.buttons[button].pressed; return Mouse.buttons[button].pressed;
} }
#endif //GGI_INPUT #endif /* GII_INPUT */

View file

@ -1,3 +1,7 @@
#include <conf.h>
#ifdef GGI_VIDEO
#include <ggi/ggi.h> #include <ggi/ggi.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -7,6 +11,7 @@
#include "palette.h" #include "palette.h"
#include "u_mem.h" #include "u_mem.h"
#include "error.h" #include "error.h"
#include "console.h"
#include "gamefont.h" #include "gamefont.h"
@ -15,6 +20,7 @@ void *screenbuffer;
ggi_visual_t *screenvis; ggi_visual_t *screenvis;
const ggi_directbuffer *dbuffer; const ggi_directbuffer *dbuffer;
ggi_mode init_mode;
ubyte use_directbuffer; ubyte use_directbuffer;
@ -28,7 +34,7 @@ void gr_update()
int gr_set_mode(u_int32_t mode) int gr_set_mode(u_int32_t mode)
{ {
unsigned int w, h; unsigned int w, h;
ggi_mode other_mode; ggi_mode other_mode;
#ifdef NOGRAPH #ifdef NOGRAPH
return 0; return 0;
@ -87,14 +93,15 @@ int gr_set_mode(u_int32_t mode)
gr_set_current_canvas(NULL); gr_set_current_canvas(NULL);
gamefont_choose_game_font(w,h); //gamefont_choose_game_font(w,h);
return 0; return 0;
} }
int gr_init(int mode) int gr_init(void)
{ {
int retcode; int retcode;
int mode = SM(648,480);
// Only do this function once! // Only do this function once!
if (gr_installed==1) if (gr_installed==1)
return -1; return -1;
@ -103,6 +110,7 @@ int gr_init(int mode)
ggiInit(); ggiInit();
screenvis = ggiOpen(NULL); screenvis = ggiOpen(NULL);
ggiGetMode(screenvis, &init_mode);
if ((retcode=gr_set_mode(mode))) if ((retcode=gr_set_mode(mode)))
return retcode; return retcode;
@ -123,6 +131,7 @@ void gr_close ()
{ {
if (gr_installed==1) if (gr_installed==1)
{ {
ggiSetMode(screenvis, &init_mode);
ggiClose(screenvis); ggiClose(screenvis);
ggiExit(); ggiExit();
gr_installed = 0; gr_installed = 0;
@ -326,3 +335,4 @@ void gr_palette_read (ubyte *pal)
} }
} }
#endif /* GGI_VIDEO */