Commit 3b28e2ab authored by digitalLumberjack's avatar digitalLumberjack

Merge remote-tracking branch 'aloshi/master' into recalbox-buildroot

parents 18379911 646bede3
......@@ -4,10 +4,10 @@
// Do this version number update as the very last commit for the new release version.
#define PROGRAM_VERSION_MAJOR 2
#define PROGRAM_VERSION_MINOR 0
#define PROGRAM_VERSION_MAINTENANCE 0
#define PROGRAM_VERSION_STRING "2.0.0-rc1"
#define PROGRAM_VERSION_MAINTENANCE 1
#define PROGRAM_VERSION_STRING "2.0.1a"
#define PROGRAM_BUILT_STRING __DATE__ " - " __TIME__
#define RESOURCE_VERSION_STRING "2,0,0\0"
#define RESOURCE_VERSION_STRING "2,0,1\0"
#define RESOURCE_VERSION PROGRAM_VERSION_MAJOR,PROGRAM_VERSION_MINOR,PROGRAM_VERSION_MAINTENANCE
......@@ -10,12 +10,13 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system) : Gui
addChild(&mMenu);
// jump to letter
char curChar = getGamelist()->getCursor()->getName()[0];
char curChar = toupper(getGamelist()->getCursor()->getName()[0]);
if(curChar < 'A' || curChar > 'Z')
curChar = 'A';
mJumpToLetterList = std::make_shared<LetterList>(mWindow, "JUMP TO LETTER", false);
for(char c = 'A'; c <= 'Z'; c++)
{
mJumpToLetterList->add(std::string(1, c), c, c == curChar);
}
ComponentListRow row;
row.addElement(std::make_shared<TextComponent>(mWindow, "JUMP TO LETTER", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
......
......@@ -72,7 +72,6 @@ set(CORE_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/Music.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/platform.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer_draw_gl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer_init.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer_init_sdlgl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Settings.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Sound.cpp
......
......@@ -6,7 +6,6 @@
#include "platform.h"
#include <Eigen/Dense>
#include GLHEADER
//#include "Font.h"
class GuiComponent;
class Font;
......@@ -19,10 +18,6 @@ namespace Renderer
bool init(int w, int h);
void deinit();
//doesn't do anything right now
void onInit();
void onDeinit();
unsigned int getScreenWidth();
unsigned int getScreenHeight();
......
......@@ -21,14 +21,11 @@ namespace Renderer {
void buildGLColorArray(GLubyte* ptr, unsigned int color, unsigned int vertCount)
{
//convert color from ???? to RGBA?
unsigned int colorRGBA;
setColor4bArray((GLubyte *)&colorRGBA, color);
//write color to unsigned int array
GLuint * uiPtr = (GLuint *)ptr;
unsigned int colorGl;
setColor4bArray((GLubyte*)&colorGl, color);
for(unsigned int i = 0; i < vertCount; i++)
{
uiPtr[i] = colorRGBA;
((GLuint*)ptr)[i] = colorGl;
}
}
......
#include "Renderer.h"
#include "platform.h"
#include GLHEADER
#include "resources/Font.h"
namespace Renderer
{
void onInit()
{
}
void onDeinit()
{
}
};
......@@ -153,15 +153,11 @@ namespace Renderer
glMatrixMode(GL_MODELVIEW);
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
onInit();
return true;
}
void deinit()
{
onDeinit();
destroySurface();
}
};
......@@ -6,7 +6,7 @@
DateTimeComponent::DateTimeComponent(Window* window, DisplayMode dispMode) : GuiComponent(window),
mEditing(false), mEditIndex(0), mDisplayMode(dispMode), mRelativeUpdateAccumulator(0),
mColor(0x777777FF), mFont(Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT)), mUppercase(false), mSizeSet(false)
mColor(0x777777FF), mFont(Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT)), mUppercase(false), mAutoSize(true)
{
updateTextCache();
}
......@@ -54,9 +54,9 @@ bool DateTimeComponent::input(InputConfig* config, Input input)
}
int incDir = 0;
if(config->isMappedTo("up", input))
if(config->isMappedTo("up", input) || config->isMappedTo("pageup", input))
incDir = 1;
else if(config->isMappedTo("down", input))
else if(config->isMappedTo("down", input) || config->isMappedTo("pagedown", input))
incDir = -1;
if(incDir != 0)
......@@ -253,9 +253,15 @@ void DateTimeComponent::updateTextCache()
std::shared_ptr<Font> font = getFont();
mTextCache = std::unique_ptr<TextCache>(font->buildTextCache(dispString, 0, 0, mColor));
if(!mSizeSet)
if(mAutoSize)
{
mSize = mTextCache->metrics.size;
mAutoSize = false;
if(getParent())
getParent()->onSizeChanged();
}
//set up cursor positions
mCursorBoxes.clear();
......@@ -298,7 +304,7 @@ void DateTimeComponent::setFont(std::shared_ptr<Font> font)
void DateTimeComponent::onSizeChanged()
{
mSizeSet = true;
mAutoSize = false;
updateTextCache();
}
......@@ -310,14 +316,20 @@ void DateTimeComponent::setUppercase(bool uppercase)
void DateTimeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme, const std::string& view, const std::string& element, unsigned int properties)
{
GuiComponent::applyTheme(theme, view, element, properties);
using namespace ThemeFlags;
const ThemeData::ThemeElement* elem = theme->getElement(view, element, "datetime");
if(!elem)
return;
// We set mAutoSize BEFORE calling GuiComponent::applyTheme because it calls
// setSize(), which will call updateTextCache(), which will reset mSize if
// mAutoSize == true, ignoring the theme's value.
if(properties & ThemeFlags::SIZE)
mAutoSize = !elem->has("size");
GuiComponent::applyTheme(theme, view, element, properties);
using namespace ThemeFlags;
if(properties & COLOR && elem->has("color"))
setColor(elem->get<unsigned int>("color"));
......
......@@ -62,5 +62,5 @@ private:
std::shared_ptr<Font> mFont;
bool mUppercase;
bool mSizeSet;
bool mAutoSize;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment