Rogue Class Linux Download Login

Artifact Content

Artifact 94d87cc4094a8dfd75d18b0d49956618128536d3:


--- ia-16.0/src/Renderer.cpp.orig	2014-08-27 13:03:22.745259803 -0700
+++ ia-16.0/src/Renderer.cpp	2014-08-27 16:24:38.830207572 -0700
@@ -21,6 +21,44 @@
 #include "Utils.h"
 #include "CommonData.h"
 #include "SdlWrapper.h"
+#include "rcl.h"
+
+#ifdef RCL
+extern "C" {
+SDL_Surface *old_surface = NULL;
+
+void iaBlitGraphics(vkbd *kbd) {
+  SDL_Rect r;
+  if (kbd->keysEmu) {
+    if (old_surface == NULL) {
+      /* back up the surface before blitting the keyboard */
+      old_surface = SDL_ConvertSurface(kbd->win, kbd->win->format, SDL_SWSURFACE);
+    }
+    r.x = 32;
+    r.y = 32;
+    r.w = 0;
+    r.h = 0;
+    SDL_BlitSurface(kbd->sf, NULL, kbd->win, &r);
+  } else {
+    if (old_surface != NULL) {
+      /* restore the old surface */
+      r.x = 0;
+      r.y = 0;
+      r.w = kbd->win->w;
+      r.h = kbd->win->h;
+      SDL_BlitSurface(old_surface, &r, kbd->win, &r);
+      SDL_FreeSurface(old_surface);
+      old_surface = NULL;
+    } 
+  }
+  return;
+}
+
+void iaFlushGraphics(vkbd *kbd) {
+  Renderer::updateScreen();
+}
+} /* extern "C" */
+#endif
 
 using namespace std;
 
@@ -303,6 +341,10 @@
 } //Namespace
 
 void init(Engine& engine) {
+#ifdef RCL
+  vjoy *joy = NULL;
+  vkbd *kbd = NULL;
+#endif  
   trace << "Renderer::init()..." << endl;
   cleanup();
 
@@ -328,6 +370,15 @@
     trace << "in Renderer::init()" << endl;
   }
 
+#ifdef RCL
+  SDL_ShowCursor(SDL_DISABLE);
+  joy = vjoyNew(NULL, NULL, VJOY_FANCYHAT, NULL);
+  kbd = vkbdNew("ia", joy, screenSurface, iaBlitGraphics,
+    iaFlushGraphics, VKBD_NONE, NULL);
+  vjoySetContext(joy);
+  vkbdSetContext(kbd);
+#endif
+
   loadFont();
 
   if(Config::isTilesMode()) {
@@ -357,7 +408,12 @@
 }
 
 void updateScreen() {
-  if(isInited()) {SDL_Flip(screenSurface);}
+  if (isInited()) {
+#ifdef RCL
+    vkbdBlitGraphics(NULL);
+#endif
+    SDL_Flip(screenSurface);
+  }
 }
 
 void clearScreen() {