]> Chaos Git - vn/vndc.git/commitdiff
Software mode is now supported
authorchaoskagami <chaos.kagami@gmail.com>
Tue, 26 Aug 2014 04:19:52 +0000 (00:19 -0400)
committerchaoskagami <chaos.kagami@gmail.com>
Tue, 26 Aug 2014 04:19:52 +0000 (00:19 -0400)
15 files changed:
buildscripts/build.generic
external/Android/AndroidManifest.xml
external/Android/jni/src/Android.mk
external/zero/include/Zero.hpp
external/zero/src/ContextManager.cpp
external/zero/src/TextManager.cpp
external/zero/src/UDisplayable.cpp
vndc/include/Data.hpp
vndc/include/Funcs.hpp
vndc/include/gitrev.hpp
vndc/src/Data.cpp
vndc/src/Loop.cpp
vndc/src/VNDC.cpp
vndc/src/op_bgload.cpp
vndc/src/op_cleartext.cpp

index 66dd153c1fcca7d9bc27ef0729b275c1ffd90cef..25f8183c53a7bea4a9226dae0cc70a9646a09060 100755 (executable)
@@ -11,7 +11,7 @@ SRC=$ROOT/
 LIB=$ROOT/external/lib
 BIN=$ROOT/bin
 
-CXXFLAGS="`pkg-config sdl2 --cflags` `pkg-config SDL2_mixer --cflags` `pkg-config SDL2_image --cflags` `pkg-config SDL2_ttf --cflags`"
+CXXFLAGS="-g `pkg-config sdl2 --cflags` `pkg-config SDL2_mixer --cflags` `pkg-config SDL2_image --cflags` `pkg-config SDL2_ttf --cflags`"
 LDFLAGS="`pkg-config sdl2 --libs` `pkg-config SDL2_image --libs` `pkg-config SDL2_ttf --libs` `pkg-config SDL2_mixer --libs`"
 INCLUDE="-I$ROOT/external/zero/include -I$ROOT/vndc/include"
 
index cf06c9efaf791d940db586e1679497d3a6660dd1..a3c10c17687a73ec3a8932e0742b69689622a0ed 100644 (file)
@@ -3,7 +3,7 @@
      com.gamemaker.game
 -->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-      package="com.github.chaoskagami.vnds"
+      package="com.github.chaoskagami.vndc"
       android:versionCode="1"
       android:versionName="1.0"
       android:installLocation="auto">
@@ -25,6 +25,7 @@
         <activity android:name="VNDCActivity"
                   android:label="@string/app_name"
                   android:configChanges="keyboardHidden|orientation"
+                  android:screenOrientation="landscape"
                   >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -34,7 +35,7 @@
     </application>
 
     <!-- Android 2.3.3 -->
-    <uses-sdk android:minSdkVersion="12" android:targetSdkVersion="12" />
+    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="12" />
 
     <!-- OpenGL ES 2.0 -->
     <uses-feature android:glEsVersion="0x00020000" /> 
index 74288e5fad6485d5f963610659f169034667bfec..a2c8b95e3cec7c012dda554ef200467fb9d50cba 100644 (file)
@@ -29,13 +29,12 @@ op_text.cpp \
 Data.cpp \
 Loop.cpp \
 Parse.cpp \
-VNDC.cpp \
 AudioManager.cpp \
 ContextManager.cpp \
 TextManager.cpp \
-UDisplayable.cpp
-
-
+UDisplayable.cpp \
+../SDL/src/main/android/SDL_android_main.c \
+VNDC.cpp
 
 
 LOCAL_SHARED_LIBRARIES := SDL2 SDL2_mixer SDL2_ttf SDL2_image
index 0f7b6a704c574aa06b945a18cda2177c2e858528..9ff789f2429327a64f763884dee127e7a28415b3 100644 (file)
@@ -5,6 +5,8 @@
 #include <windows.h>
 #endif
 
+#include <gitrev.hpp>
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <SDL_mixer.h>
 #include <SDL_ttf.h>
 
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+    #define RED_MASK   0xff000000
+    #define GREEN_MASK         0x00ff0000
+    #define BLUE_MASK  0x0000ff00
+    #define ALPHA_MASK         0x000000ff
+#else
+    #define RED_MASK   0x000000ff
+    #define GREEN_MASK         0x0000ff00
+    #define BLUE_MASK  0x00ff0000
+    #define ALPHA_MASK         0xff000000
+#endif
+
 #include "AudioManager.hpp"
 #include "ContextManager.hpp"
 #include "TextManager.hpp"
index 50e27f4f3ddac938e99b005d9a45fc034dfaf90c..420bb82b4b5fdb302d1da92148893d7b9fd09429 100644 (file)
@@ -89,7 +89,8 @@
                }
                else {
                        _InitWindowSW(width, height, fulls);
-                       this->surface_o = SDL_CreateRGBSurface(0, width, height, 32, 0, 0, 0, 0);
+                       this->surface_o = SDL_CreateRGBSurface(0, width, height, 32, RED_MASK, GREEN_MASK, BLUE_MASK, ALPHA_MASK);
+                       SDL_SetSurfaceBlendMode(this->surface_o, SDL_BLENDMODE_BLEND);
                }
 
                txtMgr = new TextManager(this);
 
        void ContextManager::_InitWindowSW(int width, int height, bool fulls) {
                // Add title setting function.
-               this->window = SDL_CreateWindow("Zero", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_SHOWN);
+               if(!fulls)
+                       this->window = SDL_CreateWindow("Zero", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_SHOWN);
+               else
+                       this->window = SDL_CreateWindow("Zero", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_FULLSCREEN);
                if(this->window == NULL) {
                        fprintf(stderr, "[E] Error creating window. Info:\n");
                        fprintf(stderr, "[E] %s\n", SDL_GetError());
                }
                else {
                        SDL_SetHintWithPriority(SDL_HINT_RENDER_VSYNC, "1", SDL_HINT_OVERRIDE);
-                       if(!SDL_CreateRenderer( this->window, -1, SDL_RENDERER_ACCELERATED )) {
+                       if(!SDL_CreateRenderer( this->window, -1, 0 )) {
                                fprintf(stderr, "[E] Error creating renderer. Info:\n");
                                fprintf(stderr, "[E] %s\n", SDL_GetError());
                                fprintf(stderr, "[E] This is fatal. Dying.");
                                exit(-1);
                        }
+
+                       this->logicalRender = false;
                }
        }
 
        void ContextManager::_InitWindowAC(int width, int height, bool fulls) {
                this->accelerate = true;
 
-               this->window = SDL_CreateWindow("Zero", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_SHOWN);
+               if(!fulls)
+                       this->window = SDL_CreateWindow("Zero", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_SHOWN);
+               else
+                       this->window = SDL_CreateWindow("Zero", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_FULLSCREEN);
                if(this->window == NULL) {
                        fprintf(stderr, "[E] Error creating window. Info:\n");
                        fprintf(stderr, "[E] %s\n", SDL_GetError());
                }
                else {
                        _InitWindowLogicalSW(width_win, height_win, width_log, height_log, fulls);
-                       this->surface_o = SDL_CreateRGBSurface(0, width_win, height_win, 32, 0, 0, 0, 0);
+                       this->surface_o = SDL_CreateRGBSurface(0, width_win, height_win, 32, RED_MASK, GREEN_MASK, BLUE_MASK, ALPHA_MASK);
+                       SDL_SetSurfaceBlendMode(this->surface_o, SDL_BLENDMODE_BLEND);
                }
 
                txtMgr = new TextManager(this);
 
        // Init window with a logical size and a real one.
        void ContextManager::_InitWindowLogicalSW(int width_win, int height_win, int width_log, int height_log, bool fulls) {
-               this->window = SDL_CreateWindow("Zero", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width_win, height_win, SDL_WINDOW_SHOWN);
+               if(!fulls)
+                       this->window = SDL_CreateWindow("Zero", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width_win, height_win, SDL_WINDOW_SHOWN);
+               else
+                       this->window = SDL_CreateWindow("Zero", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width_win, height_win, SDL_WINDOW_FULLSCREEN);
                if(this->window == NULL) {
                        fprintf(stderr, "[E] Error creating window. Info:\n");
                        fprintf(stderr, "[E] %s\n", SDL_GetError());
                        exit(-1);
                }
                else {
-                       this->renderer = SDL_CreateRenderer( this->window, -1, SDL_RENDERER_ACCELERATED );
+                       this->renderer = SDL_CreateRenderer( this->window, -1, 0 );
                        if(this->renderer == NULL) {
                                fprintf(stderr, "[E] Error creating renderer. Info:\n");
                                fprintf(stderr, "[E] %s\n", SDL_GetError());
                        else {
                                this->logicalRender = true;
 
-                               this->surface = SDL_CreateRGBSurface(0, width_log, height_log, 32, 0, 0, 0, 0);
+                               this->surface = SDL_CreateRGBSurface(0, width_log, height_log, 32, RED_MASK, GREEN_MASK, BLUE_MASK, ALPHA_MASK);
                        }
                }
        }
                // Init window with a logical size and a real one.
        void ContextManager::_InitWindowLogicalAC(int width_win, int height_win, int width_log, int height_log, bool fulls) {
                this->accelerate = true;
-
-               this->window = SDL_CreateWindow("Zero", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width_win, height_win, SDL_WINDOW_SHOWN);
+               if(!fulls)
+                       this->window = SDL_CreateWindow("Zero", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width_win, height_win, SDL_WINDOW_SHOWN);
+               else
+                       this->window = SDL_CreateWindow("Zero", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width_win, height_win, SDL_WINDOW_FULLSCREEN);
                if(this->window == NULL) {
                        fprintf(stderr, "[E] Error creating window. Info:\n");
                        fprintf(stderr, "[E] %s\n", SDL_GetError());
                else {
                        if (logicalRender)
                                SDL_FillRect(this->surface, NULL, SDL_MapRGB(this->surface->format, 0x0, 0x0, 0x0));
-                       SDL_FillRect(this->surface_o, NULL, SDL_MapRGB(this->surface_o->format, 0x0, 0x0, 0x0));
+
+                       SDL_FillRect(this->surface_o, NULL, SDL_MapRGBA(this->surface_o->format, 0x0, 0x0, 0x0, 0x0));
 
                        SDL_FillRect(SDL_GetWindowSurface(this->window), NULL, SDL_MapRGB(SDL_GetWindowSurface(this->window)->format, 0x0, 0x0, 0x0));
                }
                        SDL_SetRenderTarget(renderer, NULL);
                }
                else {
-                       SDL_FillRect(this->surface_o, NULL, SDL_MapRGB(this->surface_o->format, 0x0, 0x0, 0x0));
+                       SDL_FillRect(this->surface_o, NULL, SDL_MapRGBA(this->surface_o->format, 0, 0, 0, 0));
                }
        }
 
index 8b230da6814f34b2c0fc414b302d06bdb1828110..e6cfcf13f70e0872fc13a05c7badf5135df5fae4 100644 (file)
@@ -74,12 +74,6 @@ void TextManager::Render(char* text, int x, int y) {
                TTF_SetFontOutline(fonts[current_font], 0);
        }
 
-       SDL_Texture *tmp1 = NULL, *tmp2 = NULL;
-
-       tmp1 = SDL_CreateTextureFromSurface(ctx->Renderer(), sf1);
-       if(outline)
-               tmp2 = SDL_CreateTextureFromSurface(ctx->Renderer(), sf2);
-
        SDL_Rect src, dst, src2, dst2;
        src.x = 0;
        src.y = 0;
@@ -101,14 +95,30 @@ void TextManager::Render(char* text, int x, int y) {
                dst2.y = y - (outline_px);
                dst2.w = src2.w;
                dst2.h = src2.h;
-               SDL_FreeSurface(sf2);
+       }
+       
+       if(ctx->Accelerated()) {
+               SDL_Texture *tmp1 = NULL, *tmp2 = NULL;
+
+               tmp1 = SDL_CreateTextureFromSurface(ctx->Renderer(), sf1);
+               if(outline)
+                       tmp2 = SDL_CreateTextureFromSurface(ctx->Renderer(), sf2);
+
                ctx->OverlayBlit(tmp2, &src2, &dst2);
+               ctx->OverlayBlit(tmp1, &src, &dst);
+
                SDL_DestroyTexture(tmp2);
+               SDL_DestroyTexture(tmp1);
+
+       }
+       else {
+               ctx->OverlayBlit(sf2, &src, &dst);
+               ctx->OverlayBlit(sf1, &src, &dst);
        }
 
+       SDL_FreeSurface(sf2);
        SDL_FreeSurface(sf1);
-       ctx->OverlayBlit(tmp1, &src, &dst);
-       SDL_DestroyTexture(tmp1);
+
 
 }
 
index e6ed1e74f6646a36fc551e65162fb82a5c4552c7..ef754a03f1b413195911dd5a7e8eebe13a889c47 100644 (file)
 
        // Sets the Displayable's mode.
        UDisplayable::UDisplayable(ContextManager* cx, UDisplayableMode mode, char* fname) {
-               UDisplayable(cx, fname);
+               // UDisplayable(cx, fname);
+
+
+               DefaultVars();
+
+               SDL_Surface* bitmap_tmp = IMG_Load(fname);
+
+               if(!bitmap_tmp) {
+                       printf("[UDisplayable::Ctor] File could not be loaded, this->Error set.\n");
+                       Error = true;
+               }
+               else {
+                       this->x = 0;
+                       this->y = 0;
+                       this->loc.x = 0;
+                       this->loc.y = 0;
+                       this->ctx = cx;
+                       this->frameWidth = bitmap_tmp->w;
+                       this->bmp_w = bitmap_tmp->w;
+                       this->bmp_h = bitmap_tmp->h;
+
+                       // We still allocate the two arrays, regardless.
+
+                       // These values are unused, but we'll default them so it will operate normally.
+                       hitbox = (int*)calloc(sizeof(int), 4);
+
+                       // By default, it will fill this with 0, 0, W, H.
+                       // This will behave identically to a displayable.
+                       hitbox[0] = 0;
+                       hitbox[1] = 0;
+                       hitbox[2] = bitmap_tmp->w;
+                       hitbox[3] = bitmap_tmp->h;
+
+                       this->loc.w = bitmap_tmp->w;
+                       this->loc.h = bitmap_tmp->w;
+
+                       frame = (int*)calloc(sizeof(int), 4);
+
+                       frame[0] = 0;
+                       frame[1] = 0;
+                       frame[2] = cx->GetWidth();
+                       frame[3] = cx->GetHeight();
+
+                       // Determine if we're on an accelerated context. If so, we create a texture out of the bitmap.
+                       // Then we store what we'll use to the void* bitmap, either Tex or Surf.
+
+                       if (cx->Accelerated()) {
+                               SDL_Texture* tex = SDL_CreateTextureFromSurface(ctx->Renderer(), bitmap_tmp);
+                               this->bitmap = (void*)tex;
+                               SDL_FreeSurface(bitmap_tmp);
+                       }
+                       else {
+                               this->bitmap = (void*)bitmap_tmp;
+                       }
+               }
+               #ifdef DEBUG_OVERKILL
+               printf("[UDisplayable~Ctor] accel:%d\n", cx->Accelerated());
+               #endif
+
                this->dispMode = mode;
        }
 
                printf("[UDisplayable::Blit]\n");
                #endif
 
+               SDL_Rect src;
+               src.x = 0;
+               src.y = 0;
+               src.w = frameWidth;
+               src.h = bmp_h;
+
                if (frameIndex == -1) {
-                       ctx->Blit(bitmap, NULL, &loc_adj);
+                       ctx->Blit(bitmap, &src, &loc_adj);
                        return;
                }
 
index c861447e3d42f40381d7fd6b3e319cdea56829bb..d5385c55e66046ab88494195ff0d5a56399dacf9 100644 (file)
@@ -35,6 +35,7 @@ class DataContainer {
                bool verbose;
                int currentLine;
                bool skip_key_on;
+               bool sw_rendering;
                bool eof;
                char* window_name;
                char* next_line; // Used for voice-detect.
index 230390cf96052043c40a7d5d5c8fba0a7b095569..4153a6fab91f6254ddbd0ddf9bd3445385a426db 100644 (file)
@@ -8,11 +8,6 @@
 
 #include "gitrev.hpp"
 
-// No output capabilities.
-#ifdef WITH_ANDROID
-# define printf(...)
-#endif
-
 #include "Data.hpp"
 
 void Parse();                          // This reads commands from files.
index b440e2e8e5c60f270a0bd36f8b99590a777f11ea..1dbb938ad8b688f3e7f842a7c17b0bfcdcf61405 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef GIT_REV_HDR
 #define GIT_REV_HDR
-#define GIT_REV "c7ef31d2ee1c2c24b2c76369d203ac024dfae5f9"
+#define GIT_REV "456cf80a21b450122572c15584e45b8d502cab45"
 
 #endif
index 25ece20fd655a9a640a948256b753dc8e6b26522..dc01e0e698c2f8207d89c8f1f63e9b5046a75c51 100644 (file)
@@ -30,6 +30,11 @@ DataContainer::DataContainer() {
        verbose = false;
        currentLine = 0;
        skip_key_on = false;
+       #ifdef USE_ANDROID
+       sw_rendering = true;
+       #else
+       sw_rendering = false;
+       #endif
        eof = false;
        next_line = NULL; // Used for voice-detect.
                                // It's impossible to parse without lookahead.
index 3a9e32f6cf02353fea07cc4a9185fcf40250acf5..88a8536f66d3edd8bd7342cd1c431cf8dad222ef 100644 (file)
@@ -39,7 +39,7 @@ void Loop() {
 
 void Setup() {
        // Init window
-       GetData()->ctx->InitWindowLogical(GetData()->physical_w, GetData()->physical_h, GetData()->screen_w, GetData()->screen_h, false, true);
+       GetData()->ctx->InitWindowLogical(GetData()->physical_w, GetData()->physical_h, GetData()->screen_w, GetData()->screen_h, false, !(GetData()->sw_rendering));
 
        GetData()->window_name = (char*)calloc(sizeof(char), 400);
        sprintf(GetData()->window_name, "%s", "VNDC Interpreter ");
index 3ed644ef0300fed392f56559f4103011cd485ccf..19f4f8161eecf00ff15b6dc70e54ff40688d067b 100644 (file)
@@ -26,12 +26,26 @@ int main(int argc, char** argv) {
        bool enable_v = false;
        bool newgame = false;
        char c;
+       #ifdef USE_ANDROID
+       bool software = true;
+       #else
+       bool software = false;  
+       #endif
 
-       while((c = getopt(argc, argv, "nbvx:y:d:m:s:ch")) != -1) {
+       while((c = getopt(argc, argv, "wnbvx:y:d:m:s:ch")) != -1) {
                switch(c) {
+                       case 'w':
+                               #ifdef USE_ANDROID
+                               printf("[info] Forcing Hardware Acceleration.\n");
+                               #else
+                               printf("[info] Utilizing Software Rendering.\n");
+                               #endif
+                               software = !software;
+                               break;
                        case 'n':
                                printf("[info] New game, not reloading save.\n");
-                               newgame = true;                 
+                               newgame = true;
+                               break;
                        case 'v':
                                printf("[info] Script commands will be echoed.\n");
                                enable_v = true;
@@ -65,6 +79,7 @@ int main(int argc, char** argv) {
                                break;
                        case 'h':
                                printf("-x size -y size\tStretch display window to WxH\n");
+                               printf("-w\t\tUse Software Rendering (on android: force HW render)\n");
                                printf("-n\t\tNew Game. Do not reload default save.\n");
                                printf("-d dir\t\tChange to directory/Run game in directory\n");
                                printf("-b\t\tDebug Mode. Hit Ctrl+C on console for shell\n");
@@ -97,6 +112,7 @@ int main(int argc, char** argv) {
        }
        GetData()->vndc_enabled = vndc_extensions;
        GetData()->verbose = enable_v;
+       GetData()->sw_rendering = software;
        if(debug_enable) {
                signal(SIGINT, DebugTrap);
                GetData()->debug_mode = true;
index 119eacb71cf2c123f1431b13d29773a8d2bdbee7..3cfa12ede2a6c69c893d066139a6c37657d9ccca 100644 (file)
@@ -20,7 +20,10 @@ void op_bgload(char* file, int* fadetime) {
        //printf("Attempt to load file %s as BG\n", path);
 
        // Load displayable.
-       SDL_Surface* sfc = IMG_Load(GetData()->current_bg);
+
+       UDisplayable* disp = new UDisplayable(GetData()->ctx, GetData()->current_bg);
+
+       // SDL_Surface* sfc = IMG_Load(GetData()->current_bg);
 
        uint8_t transp_incr = 16;
        if(fadetime != NULL)
@@ -28,18 +31,17 @@ void op_bgload(char* file, int* fadetime) {
 
        // Transition effect.
 
-       SDL_Texture* tx = NULL;
-       tx = SDL_CreateTextureFromSurface(GetData()->ctx->Renderer(), sfc);
-       SDL_SetTextureBlendMode(tx, SDL_BLENDMODE_BLEND);
+       // SDL_Texture* tx = NULL;
+       // tx = SDL_CreateTextureFromSurface(GetData()->ctx->Renderer(), sfc);
+       // SDL_SetTextureBlendMode(tx, SDL_BLENDMODE_BLEND);
 
-       SDL_FreeSurface(sfc);
+       // SDL_FreeSurface(sfc);
 
        int delay = 1;
-       for(int tr = 0; tr < 255; tr += transp_incr) {
-               SDL_SetTextureAlphaMod(tx, tr);
-               GetData()->ctx->Blit(tx, NULL, NULL);
+       for(int tr = 0; tr < 255; tr += transp_incr) {          
+               disp->Blit();
                op_delay(&delay);
        }
 
-       SDL_DestroyTexture(tx);
+//     SDL_DestroyTexture(tx);
 }
index 4f917c51497333b99b0dc49c949fe77b82d3bdb8..27c762d1df4d2a277c9740cefb314f8618c86572 100644 (file)
@@ -7,8 +7,11 @@ void ct_transwindow() {
        int width_dr = (GetData()->render_x2 - GetData()->render_x1 + 20);
        int height_dr = (GetData()->render_y2 - GetData()->render_y1 + 30 + 20);
 
-       SDL_Surface* sfc = SDL_CreateRGBSurface(0, width_dr, height_dr, 32, 0, 0, 0, 0);
-       SDL_FillRect(sfc, NULL, SDL_MapRGBA(sfc->format, 0, 0, 0, 128));
+       // if(! GetData()->ctx->Accelerated()) return;
+       SDL_Surface* sfc = SDL_CreateRGBSurface(0, width_dr, height_dr, 32, RED_MASK, GREEN_MASK, BLUE_MASK, ALPHA_MASK);
+       SDL_FillRect(sfc, NULL, SDL_MapRGBA(sfc->format, 0, 0, 0, 100));
+       if(!GetData()->ctx->Accelerated()) {
+       }
 
        SDL_Rect src;
        src.x = 0;
@@ -16,21 +19,27 @@ void ct_transwindow() {
        src.w = sfc->w;
        src.h = sfc->h;
 
-       SDL_Texture* dim = SDL_CreateTextureFromSurface(GetData()->ctx->Renderer(), sfc);
-       SDL_SetTextureBlendMode(dim, SDL_BLENDMODE_BLEND);
-       SDL_SetTextureAlphaMod(dim, 128);
-
-       SDL_FreeSurface(sfc);
-
        SDL_Rect dst;
        dst.x = GetData()->render_x1 - 10;
        dst.y = GetData()->render_y1 - 10;
        dst.w = src.w;
        dst.h = src.h;
 
-       GetData()->ctx->OverlayBlit(dim, &src, &dst);
+       if(GetData()->ctx->Accelerated()) {
+               SDL_Texture* dim = SDL_CreateTextureFromSurface(GetData()->ctx->Renderer(), sfc);
+               //SDL_SetTextureBlendMode(dim, SDL_BLENDMODE_BLEND);
+               //SDL_SetTextureAlphaMod(dim, 128);
+
+               GetData()->ctx->OverlayBlit(dim, &src, &dst);
+
+               SDL_DestroyTexture(dim);
+       }
+       else {
+               GetData()->ctx->OverlayBlit(sfc, &src, &dst);           
+       }
+
+       SDL_FreeSurface(sfc);
 
-       SDL_DestroyTexture(dim);
 }
 
 /*