From 9eb57ce522e0067c82c562f7ba0b9b0423753597 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Mon, 22 Jan 2001 15:45:41 +0000 Subject: [PATCH] ggi support --- include/console.h | 2 ++ input/ggi/include/key.h | 8 ++++++-- input/ggi_event.c | 11 +++++++---- input/ggi_init.c | 5 +++++ input/ggi_key.c | 28 +++++----------------------- input/ggi_mouse.c | 6 ++++-- video/ggi_gr.c | 16 +++++++++++++--- 7 files changed, 42 insertions(+), 34 deletions(-) diff --git a/include/console.h b/include/console.h index a9bec931..4ca320b4 100644 --- a/include/console.h +++ b/include/console.h @@ -3,6 +3,8 @@ #ifndef _CONSOLE_H_ #define _CONSOLE_H_ 1 +#include "pstypes.h" + /* Priority levels */ #define CON_CRITICAL -2 #define CON_URGENT -1 diff --git a/input/ggi/include/key.h b/input/ggi/include/key.h index 82545713..1a3aa850 100644 --- a/input/ggi/include/key.h +++ b/input/ggi/include/key.h @@ -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. diff --git a/input/ggi_event.c b/input/ggi_event.c index c4d120b3..3e85c3ac 100644 --- a/input/ggi_event.c +++ b/input/ggi_event.c @@ -1,6 +1,7 @@ #include -#ifdef GGI_INPUT +#ifdef GII_INPUT + #include #include #include @@ -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 */ diff --git a/input/ggi_init.c b/input/ggi_init.c index 80ccebc5..dabed645 100644 --- a/input/ggi_init.c +++ b/input/ggi_init.c @@ -1,4 +1,7 @@ #include + +#ifdef GII_INPUT + #include #include #include "text.h" @@ -9,3 +12,5 @@ void arch_ggi_init() { } + +#endif /* GII_INPUT */ diff --git a/input/ggi_key.c b/input/ggi_key.c index 7be12fcb..cad14c9d 100644 --- a/input/ggi_key.c +++ b/input/ggi_key.c @@ -1,5 +1,7 @@ #include -#ifdef GGI_INPUT + +#ifdef GII_INPUT + #include #include @@ -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", -"","","","","","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 */ diff --git a/input/ggi_mouse.c b/input/ggi_mouse.c index f580c49d..d3ea606e 100644 --- a/input/ggi_mouse.c +++ b/input/ggi_mouse.c @@ -1,5 +1,7 @@ #include -#ifdef GGI_INPUT + +#ifdef GII_INPUT + #include #include #include @@ -158,4 +160,4 @@ int mouse_button_state(int button) return Mouse.buttons[button].pressed; } -#endif //GGI_INPUT +#endif /* GII_INPUT */ diff --git a/video/ggi_gr.c b/video/ggi_gr.c index 38627e4d..ed8f3976 100644 --- a/video/ggi_gr.c +++ b/video/ggi_gr.c @@ -1,3 +1,7 @@ +#include + +#ifdef GGI_VIDEO + #include #include #include @@ -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 */ -- 2.39.2