X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=AcessNative%2Facesskernel_src%2Fui_sdl.c;h=11033d988c5a2e20670b46c1968119800f486161;hb=542d8ba58741acef4f373b8e4395e03136c5404c;hp=97856f960f4a4c6c8f986c9ca307c8adee236083;hpb=02cbaac1233be9c5228973a787431fa5e0aa178e;p=tpg%2Facess2.git diff --git a/AcessNative/acesskernel_src/ui_sdl.c b/AcessNative/acesskernel_src/ui_sdl.c index 97856f96..11033d98 100644 --- a/AcessNative/acesskernel_src/ui_sdl.c +++ b/AcessNative/acesskernel_src/ui_sdl.c @@ -7,7 +7,7 @@ #define const #include "ui.h" #undef const -#include +#include // === IMPORTS === extern void AcessNative_Exit(void); @@ -39,6 +39,9 @@ int UI_Initialise(int MaxWidth, int MaxHeight) // Start main thread gInputThread = SDL_CreateThread(UI_MainThread, NULL); + while(gScreen == NULL) + SDL_Delay(10); + return 0; } @@ -54,6 +57,10 @@ Uint32 UI_GetAcessKeyFromSDL(SDLKey Sym, Uint16 Unicode) // Fast return if( gUI_Keymap[shiftState][Sym] ) return gUI_Keymap[shiftState][Sym]; + + // Enter key on acess returns \n, but SDL returns \r + if( Sym == SDLK_RETURN ) + Unicode = '\n'; // How nice of you, a unicode value if( Unicode ) @@ -82,6 +89,7 @@ Uint32 UI_GetAcessKeyFromSDL(SDLKey Sym, Uint16 Unicode) case SDLK_F10: ret = KEY_F10; break; case SDLK_F11: ret = KEY_F11; break; case SDLK_F12: ret = KEY_F12; break; + case SDLK_RETURN: ret = '\n'; break; default: printf("Unhandled key code %i\n", Sym); break; @@ -136,8 +144,8 @@ int UI_MainThread(void *Unused) acess_sym = UI_GetAcessKeyFromSDL(event.key.keysym.sym, event.key.keysym.unicode); - //if( gUI_KeyboardCallback ) - // gUI_KeyboardCallback(0x80000000|acess_sym); + if( gUI_KeyboardCallback ) + gUI_KeyboardCallback(0x80000000|acess_sym); break; default: @@ -152,15 +160,21 @@ void UI_BlitBitmap(int DstX, int DstY, int SrcW, int SrcH, Uint32 *Bitmap) SDL_Surface *tmp; SDL_Rect dstRect; +// printf("UI_BlitBitmap: Blit to (%i,%i) from %p (%ix%i 32bpp bitmap)\n", +// DstX, DstY, Bitmap, SrcW, SrcH); + tmp = SDL_CreateRGBSurfaceFrom(Bitmap, SrcW, SrcH, 32, SrcW*4, 0xFF0000, 0x00FF00, 0x0000FF, 0xFF000000); SDL_SetAlpha(tmp, 0, SDL_ALPHA_OPAQUE); dstRect.x = DstX; dstRect.y = DstY; + dstRect.w = -1; dstRect.h = -1; SDL_BlitSurface(tmp, NULL, gScreen, &dstRect); + //SDL_BlitSurface(tmp, NULL, gScreen, NULL); SDL_FreeSurface(tmp); +// SDL_Flip(gScreen); } void UI_BlitFramebuffer(int DstX, int DstY, int SrcX, int SrcY, int W, int H) @@ -182,10 +196,12 @@ void UI_FillBitmap(int X, int Y, int W, int H, Uint32 Value) dstRect.x = X; dstRect.y = Y; dstRect.w = W; dstRect.h = H; +// printf("UI_FillBitmap: gScreen = %p\n", gScreen); SDL_FillRect(gScreen, &dstRect, Value); } void UI_Redraw(void) { - // No-Op, we're not using double buffering + // TODO: Keep track of changed rectangle + SDL_UpdateRect(gScreen, 0, 0, giUI_Width, giUI_Height); }