Skip to content

Commit

Permalink
bumped version
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakz committed Jan 8, 2020
1 parent 14355a4 commit 68bd5c3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/io/stegano.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void Stegano::load(const PngData& data, Machine& m)
/* skip 2 null*/
o += 2;

compressedLength = std::min(32769ULL - RAW_DATA_LENGTH, compressedLength);
compressedLength = std::min(size_t(32769ULL - RAW_DATA_LENGTH), compressedLength);

const std::string lookup = "\n 0123456789abcdefghijklmnopqrstuvwxyz!#%(){}[]<>+=/*:;.,~_";
std::string code;
Expand All @@ -95,7 +95,7 @@ void Stegano::load(const PngData& data, Machine& m)
else
{
uint8_t vn = assembleByte(d[o + i + 1]);

auto offset = ((v - 0x3c) << 4) + (vn & 0xf);
auto length = (vn >> 4) + 2;

Expand Down Expand Up @@ -124,7 +124,7 @@ void Stegano::load(const std::string& path, Machine& m)
#if DEBUGGER
fileName = path.substr(0, path.length() - 4) + ".p8";
#endif

SDL_Surface* surface = IMG_Load(path.c_str());

if (!surface)
Expand All @@ -138,4 +138,4 @@ void Stegano::load(const std::string& path, Machine& m)
assert(surface->format->BytesPerPixel == 4);
load(pngData, m);
SDL_FreeSurface(surface);
}
}
18 changes: 9 additions & 9 deletions src/views/menu_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ std::vector<MenuEntry>::const_iterator selected;
enum { RESUME = 0, HELP, OPTIONS, RESET, EXIT, SHOW_FPS = 0, SCALER, SOUND, MUSIC, BACK };

MenuView::MenuView(ViewManager* gvm) : _gvm(gvm)
{
{
static_assert(SCALER == 1, "must be 1");

mainMenu[RESUME].lambda = [this]() {
_gvm->backToGame();
};

mainMenu[OPTIONS].lambda = [this]() {
menu = &optionsMenu;
selected = menu->begin();
};

mainMenu[EXIT].lambda = [this]() {
_gvm->exit();
};
Expand All @@ -63,7 +63,7 @@ MenuView::MenuView(ViewManager* gvm) : _gvm(gvm)
_gvm->gameView()->setScaler(Scaler::FIRST);
updateLabels();
};

optionsMenu[SOUND].lambda = [this]() {
bool v = !machine.sound().isSoundEnabled();
machine.sound().toggleSound(v);
Expand Down Expand Up @@ -152,7 +152,7 @@ void MenuView::render()
constexpr int32_t H = 240;

auto renderer = _gvm->renderer();

SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
SDL_RenderClear(renderer);

Expand All @@ -162,18 +162,18 @@ void MenuView::render()

_gvm->text("retro8", W / 2 + 2, 20 + 2, { 0, 22, 120 }, TextAlign::CENTER, 4.0f);
_gvm->text("retro8", W / 2, 20, { 0, 47, 255 }, TextAlign::CENTER, 4.0f);
_gvm->text("v0.1", W / 2 + _gvm->textWidth("retro8", 4.0)/2 + 3, 34, { 0, 47, 255 }, TextAlign::LEFT, 2.0f);
_gvm->text("v0.1b", W / 2 + _gvm->textWidth("retro8", 4.0)/2 + 3, 34, { 0, 47, 255 }, TextAlign::LEFT, 2.0f);

retro8::point_t menuBase = { W / 2, 90 };

for (auto it = menu->begin(); it != menu->end(); ++it)
{
SDL_Color color = it == selected ? SDL_Color{ 255, 255, 0 } : SDL_Color{ 255,255,255 };

if (it != selected && !it->lambda)
color = { 160, 160, 160 };

_gvm->text(it->caption, menuBase.x, menuBase.y, color, TextAlign::CENTER, 2.0f);
menuBase.y += 16;
}
}
}

0 comments on commit 68bd5c3

Please sign in to comment.