From 122df1d72689c780b20fa3d4a46667b4fa4f5802 Mon Sep 17 00:00:00 2001 From: theoddone33 Date: Wed, 29 May 2002 23:17:50 +0000 Subject: [PATCH] Non working text code and fixed keys --- include/key.h | 7 +++ src/graphics/gropengl.cpp | 100 ++++++++++++++++---------------------- src/io/key.cpp | 11 ++++- 3 files changed, 59 insertions(+), 59 deletions(-) diff --git a/include/key.h b/include/key.h index 7bd42f1..9e8b8e5 100644 --- a/include/key.h +++ b/include/key.h @@ -7,6 +7,9 @@ * Include file for keyboard reading routines * * $Log$ + * Revision 1.3 2002/05/29 23:17:49 theoddone33 + * Non working text code and fixed keys + * * Revision 1.2 2002/05/29 06:25:12 theoddone33 * Keyboard input, mouse tracking now work * @@ -69,7 +72,11 @@ extern "C" { #include "pstypes.h" +#ifndef PLAT_UNIX #define NUM_KEYS 256 +#else +#define NUM_KEYS SDLK_LAST +#endif extern int shifted_ascii_table[]; extern int ascii_table[]; diff --git a/src/graphics/gropengl.cpp b/src/graphics/gropengl.cpp index 3872fbf..766e88c 100644 --- a/src/graphics/gropengl.cpp +++ b/src/graphics/gropengl.cpp @@ -7,6 +7,9 @@ * Code that uses the OpenGL graphics library * * $Log$ + * Revision 1.17 2002/05/29 23:17:49 theoddone33 + * Non working text code and fixed keys + * * Revision 1.16 2002/05/29 19:45:13 theoddone33 * More changes on texture loading * @@ -594,7 +597,7 @@ void gr_opengl_aabitmap_ex_internal(int x,int y,int w,int h,int sx,int sy) if ( !gr_tcache_set( gr_screen.current_bitmap, TCACHE_TYPE_AABITMAP, &u_scale, &v_scale ) ) { // Couldn't set texture - //mprintf(( "GLIDE: Error setting aabitmap texture!\n" )); + mprintf(( "WARNING: Error setting aabitmap texture!\n" )); return; } @@ -607,6 +610,9 @@ void gr_opengl_aabitmap_ex_internal(int x,int y,int w,int h,int sx,int sy) bm_get_info( gr_screen.current_bitmap, &bw, &bh ); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + u0 = u_scale*i2fl(sx)/i2fl(bw); v0 = v_scale*i2fl(sy)/i2fl(bh); @@ -619,12 +625,12 @@ void gr_opengl_aabitmap_ex_internal(int x,int y,int w,int h,int sx,int sy) y2 = i2fl(y+h+gr_screen.offset_y); if ( gr_screen.current_color.is_alphacolor ) { - glColor4ub(gr_screen.current_color.red, gr_screen.current_color.green, gr_screen.current_color.blue,gr_screen.current_color.alpha); + //glColor4ub(gr_screen.current_color.red, gr_screen.current_color.green, gr_screen.current_color.blue,gr_screen.current_color.alpha); } else { - glColor3ub(gr_screen.current_color.red, gr_screen.current_color.green, gr_screen.current_color.blue); + //glColor3ub(gr_screen.current_color.red, gr_screen.current_color.green, gr_screen.current_color.blue); } - glBegin (GL_TRIANGLE_FAN); + glBegin (GL_QUADS); glTexCoord2f (u0, v0); glVertex3f (x1, y1, 0.99); @@ -1593,9 +1599,6 @@ int opengl_create_texture_sub(int bitmap_type, int texture_handle, ushort *data, t->v_scale = 1.0f; } - ushort *bmp_data = (ushort *)data; - ubyte *bmp_data_byte = (ubyte*)data; - glGenTextures (1, &t->texture_handle); glBindTexture (GL_TEXTURE_2D, t->texture_handle); @@ -1604,69 +1607,35 @@ int opengl_create_texture_sub(int bitmap_type, int texture_handle, ushort *data, glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - ushort xlat[256]; - int r, g, b, a; - int i, j; - ushort *texmem = (ushort *)malloc (tex_w*tex_h*2); switch (bitmap_type) { case TCACHE_TYPE_AABITMAP: - for (i=0; i<16;i++) { - r = 255; - g = 255; - b = 255; - a = Gr_gamma_lookup[(i*255)/15]; - /* - r /= Gr_ta_red.scale; - g /= Gr_ta_green.scale; - b /= Gr_ta_blue.scale; - a /= Gr_ta_alpha.scale; - */ - xlat[i] = (unsigned short)(((a<bitmap_id = texture_handle; t->time_created = GL_frame_count; @@ -2162,6 +2131,23 @@ void gr_opengl_init() Int3(); // Illegal bpp } + // DDOI - set these so no one else does! + Gr_ta_red.mask = 0x0f00; + Gr_ta_red.shift = 8; + Gr_ta_red.scale = 16; + + Gr_ta_green.mask = 0x00f0; + Gr_ta_green.shift = 4; + Gr_ta_green.scale = 16; + + Gr_ta_blue.mask = 0x000f; + Gr_ta_blue.shift = 0; + Gr_ta_blue.scale = 16; + + Gr_ta_alpha.mask = 0xf000; + Gr_ta_alpha.shift = 12; + Gr_ta_alpha.scale = 16; + opengl_tcache_init (0); gr_opengl_clear(); diff --git a/src/io/key.cpp b/src/io/key.cpp index 178d384..ad25a55 100644 --- a/src/io/key.cpp +++ b/src/io/key.cpp @@ -7,8 +7,11 @@ * * * $Log$ - * Revision 1.1 2002/05/03 03:28:09 root - * Initial revision + * Revision 1.2 2002/05/29 23:17:50 theoddone33 + * Non working text code and fixed keys + * + * Revision 1.1.1.1 2002/05/03 03:28:09 root + * Initial import. * * * 6 10/29/99 6:10p Jefff @@ -665,7 +668,11 @@ void key_mark( uint code, int state, uint latency ) // event_time = timeGetTime() - latency; // Read in scancode +#ifndef PLAT_UNIX scancode = code & (NUM_KEYS-1); +#else + scancode = code; +#endif breakbit = !state; if (breakbit) { -- 2.39.2