diff --git a/.gitignore b/.gitignore
index c9efe78..c4de5ad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
syntax: glob
*.orig
*.suo
+*~
.git
Build/
Documentation/Documentation/*
@@ -9,4 +10,3 @@ Documentation/Manual/_build/*
Configuration/Configuration/bin/**
Configuration/Configuration/obj/**
Artifacts/**
-
diff --git a/.project b/.project
new file mode 100644
index 0000000..56dd0cb
--- /dev/null
+++ b/.project
@@ -0,0 +1,11 @@
+
+
+ funkey_retrofe
+
+
+
+
+
+
+
+
diff --git a/RetroFE/Source/CMakeLists.txt b/RetroFE/Source/CMakeLists.txt
index 0333c91..54dca20 100755
--- a/RetroFE/Source/CMakeLists.txt
+++ b/RetroFE/Source/CMakeLists.txt
@@ -31,8 +31,8 @@ endif()
set(GSTREAMER_ROOT "C:/gstreamer/1.0/x86" CACHE STRING "location of where your gstreamer include and lib folders reside")
set(GLIB2_ROOT "${GSTREAMER_ROOT}")
-
-if(MSVC)
+
+if(MSVC)
set(DIRENT_INCLUDE_DIR "${RETROFE_THIRD_PARTY_DIR}/dirent-1.20.1/include")
endif()
endif()
@@ -50,6 +50,8 @@ if(WIN32)
find_package(SDL_ttf REQUIRED )
find_package(SDL_gfx REQUIRED )
find_package(ZLIB REQUIRED)
+
+ find_package(X11)
else()
include(FindPkgConfig)
#pkg_search_module(SDL2 REQUIRED sdl2)
@@ -70,6 +72,8 @@ if(APPLE)
#find_package(SDL2 REQUIRED)
find_package(SDL REQUIRED )
endif()
+
+ find_package(X11)
endif()
set(RETROFE_INCLUDE_DIRS
@@ -88,6 +92,7 @@ set(RETROFE_INCLUDE_DIRS
"${ZLIB_INCLUDE_DIRS}"
"${SQLITE3_ROOT}"
"${RAPIDXML_ROOT}"
+ "${X11_INCLUDE_DIR}"
)
if(MSVC)
@@ -107,6 +112,7 @@ set(RETROFE_LIBRARIES
${SDL_TTF_LIBRARIES}
${SDL_GFX_LIBRARIES}
${ZLIB_LIBRARIES}
+ ${X11_LIBRARIES}
)
if(NOT WIN32)
@@ -224,7 +230,6 @@ set(RETROFE_SOURCES
set(EXECUTABLE_OUTPUT_PATH "${RETROFE_DIR}/Build" CACHE PATH "Build directory" FORCE)
set(LIBRARY_OUTPUT_PATH "${RETROFE_DIR}/Build" CACHE PATH "Build directory" FORCE)
-
include_directories(${RETROFE_INCLUDE_DIRS})
add_executable(retrofe ${RETROFE_SOURCES} ${RETROFE_HEADERS})
target_link_libraries(retrofe ${RETROFE_LIBRARIES})
diff --git a/RetroFE/Source/Graphics/Font.cpp b/RetroFE/Source/Graphics/Font.cpp
index 264ba14..2e078e8 100644
--- a/RetroFE/Source/Graphics/Font.cpp
+++ b/RetroFE/Source/Graphics/Font.cpp
@@ -18,7 +18,7 @@
#include "../Utility/Log.h"
#include
#include
-#include
+//#include
#include
#include
diff --git a/RetroFE/Source/RetroFE.cpp b/RetroFE/Source/RetroFE.cpp
index d400a8e..8f6c23f 100644
--- a/RetroFE/Source/RetroFE.cpp
+++ b/RetroFE/Source/RetroFE.cpp
@@ -95,10 +95,25 @@ void RetroFE::render( )
//SDL_RenderClear( SDL::getRenderer( ) );
SDL_FillRect(SDL::getWindow( ), NULL, SDL_MapRGB(SDL::getWindow( )->format, 0, 0, 0));
+ uint32_t draw_ticks = SDL_GetTicks();
if ( currentPage_ )
{
currentPage_->draw( );
}
+ int draw_time = SDL_GetTicks()-draw_ticks;
+ //printf("draw time: %dms\n", draw_time);
+
+
+ // DEBUG: Average draw time over FPS*5 frames
+ static int avg_draw_time = 0;
+ static int avg_draw_time_nb_vals = 0;
+ avg_draw_time += draw_time;
+ avg_draw_time_nb_vals++;
+ if(avg_draw_time_nb_vals >= FPS*5){
+ printf("Average draw time: %dms\n", avg_draw_time/avg_draw_time_nb_vals);
+ avg_draw_time=0;
+ avg_draw_time_nb_vals=0;
+ }
//SDL_RenderPresent( SDL::getRenderer( ) );
//SDL_Flip(SDL::getWindow( ));
diff --git a/RetroFE/Source/SDL.cpp b/RetroFE/Source/SDL.cpp
index 84065ef..e5bbf76 100644
--- a/RetroFE/Source/SDL.cpp
+++ b/RetroFE/Source/SDL.cpp
@@ -182,15 +182,16 @@ bool SDL::initialize( Configuration &config )
}
SDL_FillRect(window_virtual_, NULL, SDL_MapRGBA(window_virtual_->format, 0, 0, 0, 0));
- texture_copy_alpha_ = SDL_CreateRGBSurface(0, windowWidth_, windowHeight_, 32, rmask, gmask, bmask, amask);
+ /*texture_copy_alpha_ = SDL_CreateRGBSurface(0, windowWidth_, windowHeight_, 32, rmask, gmask, bmask, amask);
if ( texture_copy_alpha_ == NULL )
{
std::string error = SDL_GetError( );
Logger::write( Logger::ZONE_ERROR, "SDL", "SDL_CreateRGBSurface texture_copy_alpha_ failed: " + error );
retVal = false;
}
- SDL_FillRect(texture_copy_alpha_, NULL, SDL_MapRGBA(texture_copy_alpha_->format, 0, 0, 0, 0));
+ SDL_FillRect(texture_copy_alpha_, NULL, SDL_MapRGBA(texture_copy_alpha_->format, 0, 0, 0, 0));*/
}
+
/*if ( retVal )
{
renderer_ = SDL_CreateRenderer( window_, -1, SDL_RENDERER_ACCELERATED );
@@ -271,11 +272,11 @@ bool SDL::deInitialize( )
window_virtual_ = NULL;
}
- if ( texture_copy_alpha_ )
+ /*if ( texture_copy_alpha_ )
{
SDL_FreeSurface(texture_copy_alpha_);
texture_copy_alpha_ = NULL;
- }
+ }*/
SDL_ShowCursor( SDL_TRUE );
@@ -569,30 +570,44 @@ bool SDL::renderCopy( SDL_Surface *texture, float alpha, SDL_Rect *src, SDL_Rect
/*SDL_SetAlpha(texture, SDL_SRCALPHA, static_cast( alpha * 255 ));
SDL_BlitSurface (texture, &srcRect, getWindow(), &dstRect);*/
+ /*if(alpha){
+ unsigned int rmask;
+ unsigned int gmask;
+ unsigned int bmask;
+ unsigned int amask;
+ #if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ rmask = 0xff000000;
+ gmask = 0x00ff0000;
+ bmask = 0x0000ff00;
+ amask = 0x000000ff;
+ #else
+ rmask = 0x000000ff;
+ gmask = 0x0000ff00;
+ bmask = 0x00ff0000;
+ amask = 0xff000000;
+ #endif
+ SDL_Surface * texture_tmp = SDL_CreateRGBSurface(0, texture->w, texture->h, 32, rmask, gmask, bmask, amask);
+ //SDL_FillRect(texture_tmp, NULL, SDL_MapRGBA(texture_tmp->format, 0, 0, 0, 0));
+ SDL_SetAlpha( texture, 0, SDL_ALPHA_OPAQUE );
+ SDL_BlitSurface (texture, NULL, texture_tmp, NULL);
+ SDL_gfxMultiplyAlpha (texture_tmp, static_cast( alpha * 255 ));
+ //SDL_gfxBlitRGBA(texture_tmp, &srcRect, getWindow(), &dstRect);
+ SDL_BlitSurface(texture_tmp, &srcRect, getWindow(), &dstRect);
+ SDL_FreeSurface(texture_tmp);
+ }*/
+
+
+ if(alpha){
+ SDL_SetAlpha(texture, SDL_SRCALPHA, static_cast( alpha * 255 ));
+ //printf("\n-----------\n");
+ //printf("Alpha = %f = %u\n", alpha, texture->format->alpha);
+ SDL_BlitSurface(texture, &srcRect, getWindow(), &dstRect);
+ }
+
+
+
+
- unsigned int rmask;
- unsigned int gmask;
- unsigned int bmask;
- unsigned int amask;
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- rmask = 0xff000000;
- gmask = 0x00ff0000;
- bmask = 0x0000ff00;
- amask = 0x000000ff;
-#else
- rmask = 0x000000ff;
- gmask = 0x0000ff00;
- bmask = 0x00ff0000;
- amask = 0xff000000;
-#endif
- SDL_Surface * texture_tmp = SDL_CreateRGBSurface(0, texture->w, texture->h, 32, rmask, gmask, bmask, amask);
- //SDL_FillRect(texture_tmp, NULL, SDL_MapRGBA(texture_tmp->format, 0, 0, 0, 0));
- SDL_SetAlpha( texture, 0, SDL_ALPHA_OPAQUE );
- SDL_BlitSurface (texture, NULL, texture_tmp, NULL);
- SDL_gfxMultiplyAlpha (texture_tmp, static_cast( alpha * 255 ));
- //SDL_gfxBlitRGBA(texture_tmp, &srcRect, getWindow(), &dstRect);
- SDL_BlitSurface(texture_tmp, &srcRect, getWindow(), &dstRect);
- SDL_FreeSurface(texture_tmp);
//texture = rotozoomSurfaceXY(texture, viewInfo.Angle, scaleX, scaleY, SMOOTHING_OFF);