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_
#define _CONSOLE_H_ 1
#include "pstypes.h"
/* Priority levels */
#define CON_CRITICAL -2
#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 $
* $Revision: 1.1.1.1 $
* $Revision: 1.2 $
* $Author: bradleyb $
* $Date: 2001-01-19 03:29:59 $
* $Date: 2001-01-22 15:42:15 $
*
* Header for keyboard functions
*
* $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
* 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
// "keyd_buffer_type" variable.
extern void key_putkey (unsigned short); // simulates a keystroke
extern void key_flush(); // Clears the 256 char buffer
extern int key_checkch(); // Returns 1 if a char is waiting
extern int key_getch(); // Gets key if one waiting other waits for one.

View file

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

View file

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

View file

@ -1,5 +1,7 @@
#include <conf.h>
#ifdef GGI_INPUT
#ifdef GII_INPUT
#include <stdio.h>
#include <stdlib.h>
@ -47,27 +49,7 @@ typedef struct keyboard {
static /*volatile*/ keyboard key_data;
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","","","","","","","","","","","","","","","","","",
"","","","","","","","","","","","","","","","","","","","",
"","","","","","","" };
char * key_text[256];
unsigned char ascii_table[128] =
{ 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>
#ifdef GGI_INPUT
#ifdef GII_INPUT
#include <stdio.h>
#include <string.h>
#include <ggi/gii.h>
@ -158,4 +160,4 @@ int mouse_button_state(int button)
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 <stdlib.h>
#include <stdio.h>
@ -7,6 +11,7 @@
#include "palette.h"
#include "u_mem.h"
#include "error.h"
#include "console.h"
#include "gamefont.h"
@ -15,6 +20,7 @@ void *screenbuffer;
ggi_visual_t *screenvis;
const ggi_directbuffer *dbuffer;
ggi_mode init_mode;
ubyte use_directbuffer;
@ -28,7 +34,7 @@ void gr_update()
int gr_set_mode(u_int32_t mode)
{
unsigned int w, h;
ggi_mode other_mode;
ggi_mode other_mode;
#ifdef NOGRAPH
return 0;
@ -87,14 +93,15 @@ int gr_set_mode(u_int32_t mode)
gr_set_current_canvas(NULL);
gamefont_choose_game_font(w,h);
//gamefont_choose_game_font(w,h);
return 0;
}
int gr_init(int mode)
int gr_init(void)
{
int retcode;
int mode = SM(648,480);
// Only do this function once!
if (gr_installed==1)
return -1;
@ -103,6 +110,7 @@ int gr_init(int mode)
ggiInit();
screenvis = ggiOpen(NULL);
ggiGetMode(screenvis, &init_mode);
if ((retcode=gr_set_mode(mode)))
return retcode;
@ -123,6 +131,7 @@ void gr_close ()
{
if (gr_installed==1)
{
ggiSetMode(screenvis, &init_mode);
ggiClose(screenvis);
ggiExit();
gr_installed = 0;
@ -326,3 +335,4 @@ void gr_palette_read (ubyte *pal)
}
}
#endif /* GGI_VIDEO */