Skip to content

Commit

Permalink
Added new layout
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasTerp committed Jul 3, 2017
1 parent 15549d3 commit 0b5f272
Show file tree
Hide file tree
Showing 77 changed files with 217 additions and 101 deletions.
Binary file modified .vs/LunkyBox/v14/.suo
Binary file not shown.
91 changes: 91 additions & 0 deletions 11rbu42n.zxv.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Your branch and 'origin/master' have diverged,
# and have 1 and 4 different commits each, respectively.
# (use "git pull" to merge the remote branch into yours)
#
# Changes to be committed:
# modified: .vs/LunkyBox/v14/.suo
# modified: LunkyBox.sdf
#
# Changes not staged for commit:
# modified: .vs/LunkyBox/v14/.suo
# modified: LunkyBox.sdf
# modified: LunkyBox/Mod/BoolMenuItem.cpp
# modified: LunkyBox/Mod/IntMenuItem.cpp
# modified: LunkyBox/Mod/Menu.cpp
# modified: LunkyBox/Mod/Mod.h
# modified: LunkyBox/Release/BoolMenuItem.obj
# modified: LunkyBox/Release/Config.obj
# modified: LunkyBox/Release/D3d9.obj
# modified: LunkyBox/Release/Drawing.obj
# modified: LunkyBox/Release/ENTITY_CLASS.obj
# modified: LunkyBox/Release/Entity.obj
# modified: LunkyBox/Release/ITEM_CLASS.obj
# modified: LunkyBox/Release/Input.obj
# modified: LunkyBox/Release/IntMenuItem.obj
# modified: LunkyBox/Release/KeyState.obj
# modified: LunkyBox/Release/LunkyBox.log
# modified: LunkyBox/Release/LunkyBox.tlog/CL.command.1.tlog
# modified: LunkyBox/Release/LunkyBox.tlog/CL.read.1.tlog
# modified: LunkyBox/Release/LunkyBox.tlog/CL.write.1.tlog
# modified: LunkyBox/Release/LunkyBox.tlog/link.read.1.tlog
# modified: LunkyBox/Release/LunkyBox.tlog/link.write.1.tlog
# modified: LunkyBox/Release/Main.obj
# modified: LunkyBox/Release/Memory.obj
# modified: LunkyBox/Release/Menu.obj
# modified: LunkyBox/Release/MenuItem.obj
# modified: LunkyBox/Release/Mod.obj
# modified: LunkyBox/Release/Module.obj
# modified: LunkyBox/Release/Player.obj
# modified: LunkyBox/Release/Spelunky.obj
# modified: LunkyBox/Release/Vector2.obj
# modified: LunkyBox/Release/Window.obj
# modified: LunkyBox/Release/vc140.pdb
# modified: LunkyBoxGOG/Mod/BoolMenuItem.cpp
# modified: LunkyBoxGOG/Mod/IntMenuItem.cpp
# modified: LunkyBoxGOG/Mod/Menu.cpp
# modified: LunkyBoxGOG/Mod/Mod.h
# modified: LunkyBoxGOG/Release/BoolMenuItem.obj
# modified: LunkyBoxGOG/Release/Config.obj
# modified: LunkyBoxGOG/Release/D3d9.obj
# modified: LunkyBoxGOG/Release/Drawing.obj
# modified: LunkyBoxGOG/Release/ENTITY_CLASS.obj
# modified: LunkyBoxGOG/Release/Entity.obj
# modified: LunkyBoxGOG/Release/ITEM_CLASS.obj
# modified: LunkyBoxGOG/Release/Input.obj
# modified: LunkyBoxGOG/Release/IntMenuItem.obj
# modified: LunkyBoxGOG/Release/KeyState.obj
# modified: LunkyBoxGOG/Release/LunkyBoxGOG.log
# modified: LunkyBoxGOG/Release/LunkyBoxGOG.tlog/link.read.1.tlog
# modified: LunkyBoxGOG/Release/LunkyBoxGOG.tlog/link.write.1.tlog
# modified: LunkyBoxGOG/Release/Main.obj
# modified: LunkyBoxGOG/Release/Menu.obj
# modified: LunkyBoxGOG/Release/MenuItem.obj
# modified: LunkyBoxGOG/Release/Mod.obj
# modified: LunkyBoxGOG/Release/Module.obj
# modified: LunkyBoxGOG/Release/Player.obj
# modified: LunkyBoxGOG/Release/Spelunky.obj
# modified: LunkyBoxGOG/Release/Vector2.obj
# modified: LunkyBoxGOG/Release/Window.obj
# modified: LunkyBoxGOG/Release/vc140.pdb
# modified: LunkyBoxInjector/Release/LunkyBoxInjector.Build.CppClean.log
# modified: LunkyBoxInjector/Release/LunkyBoxInjector.log
# modified: LunkyBoxInjector/Release/LunkyBoxInjector.tlog/link.write.1.tlog
# modified: LunkyBoxInjector/Release/Main.obj
# modified: LunkyBoxInjector/Release/vc140.pdb
# modified: Release/LunkyBox.dll
# modified: Release/LunkyBox.iobj
# modified: Release/LunkyBox.ipdb
# modified: Release/LunkyBox.pdb
# modified: Release/LunkyBoxGOG.dll
# modified: Release/LunkyBoxGOG.iobj
# modified: Release/LunkyBoxGOG.ipdb
# modified: Release/LunkyBoxGOG.pdb
# modified: Release/LunkyBoxInjector.exe
# modified: Release/LunkyBoxInjector.pdb
# modified: Release/config.txt
#

Binary file modified LunkyBox.sdf
Binary file not shown.
2 changes: 1 addition & 1 deletion LunkyBox/Mod/BoolMenuItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace Mod
LPCSTR onOffText = isOn ? "ON" : "OFF";
int textWidth = Drawing::GetTextWidth(fontMenuItem, onOffText);

Drawing::DrawText(fontMenuItem, onOffText, Config::GetNumber("menu_x") + Config::GetNumber("menu_width") - textWidth - 4, Config::GetNumber("menu_y") + TITLE_BOX_HEIGHT + 6 + (ITEM_HEIGHT + MENU_MARGIN) * menuItemIndex, Config::GetNumber("menu_width") - MENU_MARGIN, ITEM_HEIGHT - MENU_MARGIN, parentMenu->selectedMenuItemIndex == menuItemIndex ? color2 : color1);
Drawing::DrawText(fontMenuItem, onOffText, Config::GetNumber("menu_x") + Config::GetNumber("menu_width") - textWidth - 4, Config::GetNumber("menu_y") + TITLE_BOX_HEIGHT + 6 + (ITEM_HEIGHT + MENU_MARGIN) * menuItemIndex, Config::GetNumber("menu_width") - MENU_MARGIN, ITEM_HEIGHT - MENU_MARGIN, IsInFocus() ? color2 : color1);
}

void BoolMenuItem::Select()
Expand Down
2 changes: 1 addition & 1 deletion LunkyBox/Mod/IntMenuItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace Mod
LPCSTR valueLPCSTR = valueString.c_str();
int textWidth = Drawing::GetTextWidth(fontMenuItem, valueLPCSTR);

Drawing::DrawText(fontMenuItem, valueLPCSTR, Config::GetNumber("menu_x") + Config::GetNumber("menu_width") - textWidth - 4, Config::GetNumber("menu_y") + TITLE_BOX_HEIGHT + 6 + (ITEM_HEIGHT + MENU_MARGIN) * menuItemIndex, Config::GetNumber("menu_width") - MENU_MARGIN, ITEM_HEIGHT - MENU_MARGIN, parentMenu->selectedMenuItemIndex == menuItemIndex ? color2 : color1);
Drawing::DrawText(fontMenuItem, valueLPCSTR, Config::GetNumber("menu_x") + Config::GetNumber("menu_width") - textWidth - 4, Config::GetNumber("menu_y") + TITLE_BOX_HEIGHT + 6 + (ITEM_HEIGHT + MENU_MARGIN) * menuItemIndex, Config::GetNumber("menu_width") - MENU_MARGIN, ITEM_HEIGHT - MENU_MARGIN, IsInFocus() ? color2 : color1);
}

void IntMenuItem::Select()
Expand Down
76 changes: 53 additions & 23 deletions LunkyBox/Mod/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "../Input/Input.h"
#include "../Config/Config.h"

//This code is made with the classic menu_layout in mind. If you are going to try and make sense of this code, set menu_layout to classic in config.txt and see how that works ingame.

namespace Mod
{
Expand Down Expand Up @@ -90,33 +91,34 @@ namespace Mod
}
}


//previous page

if(Input::IsKeyPressed(Config::GetNumber("input_left"), Input::INPUT_MODE::CONTINUOUS))
if(Config::GetText("menu_layout") == "classic")
{
PreviousPage();
//previous page

if(Config::GetBool("menu_sounds"))
if(Input::IsKeyPressed(Config::GetNumber("input_left"), Input::INPUT_MODE::CONTINUOUS))
{
Mod::player.PlaySound(SOUND_PAGE_PREV_NEXT);
PreviousPage();

if(Config::GetBool("menu_sounds"))
{
Mod::player.PlaySound(SOUND_PAGE_PREV_NEXT);
}
}
}


//Next page
//Next page

if(Input::IsKeyPressed(Config::GetNumber("input_right"), Input::INPUT_MODE::CONTINUOUS))
{
NextPage();

if(Config::GetBool("menu_sounds"))
if(Input::IsKeyPressed(Config::GetNumber("input_right"), Input::INPUT_MODE::CONTINUOUS))
{
Mod::player.PlaySound(SOUND_PAGE_PREV_NEXT);
NextPage();

if(Config::GetBool("menu_sounds"))
{
Mod::player.PlaySound(SOUND_PAGE_PREV_NEXT);
}
}
}


//Select

if(Input::IsKeyPressed(Config::GetNumber("input_select"), Input::INPUT_MODE::CONTINUOUS))
Expand Down Expand Up @@ -180,12 +182,22 @@ namespace Mod
Drawing::DrawRectangle(deviceInterface, Config::GetNumber("menu_x"), Config::GetNumber("menu_y"), Config::GetNumber("menu_width"), TITLE_BOX_HEIGHT, color1);
Drawing::DrawText(fontMenuTitle, name.c_str(), Config::GetNumber("menu_x") + MENU_MARGIN, Config::GetNumber("menu_y") + 4, Config::GetNumber("menu_width") - MENU_MARGIN, TITLE_BOX_HEIGHT - MENU_MARGIN, color2);

if(pageCount > 1)
if(Config::GetText("menu_layout") == "classic")
{
std::stringstream pageNumberText;
pageNumberText << "Page " << page + 1 << " of " << pageCount;
if(pageCount > 1)
{
std::stringstream pageNumberText;
pageNumberText << "Page " << page + 1 << " of " << pageCount;

Drawing::DrawText(fontMenuPageNumber, pageNumberText.str().c_str(), Config::GetNumber("menu_x") + MENU_MARGIN, Config::GetNumber("menu_y") + 38, Config::GetNumber("menu_width") - MENU_MARGIN, TITLE_BOX_HEIGHT - MENU_MARGIN, color2);
Drawing::DrawText(fontMenuPageNumber, pageNumberText.str().c_str(), Config::GetNumber("menu_x") + MENU_MARGIN, Config::GetNumber("menu_y") + 38, Config::GetNumber("menu_width") - MENU_MARGIN, TITLE_BOX_HEIGHT - MENU_MARGIN, color2);
}
}
else if(Config::GetText("menu_layout") == "single_page")
{
std::stringstream indexText;
indexText << Config::GetNumber("menu_items_per_page") * page + selectedMenuItemIndex + 1 << " / " << menuItems.size();

Drawing::DrawText(fontMenuPageNumber, indexText.str().c_str(), Config::GetNumber("menu_x") + MENU_MARGIN + 2, Config::GetNumber("menu_y") + 38, Config::GetNumber("menu_width") - MENU_MARGIN, TITLE_BOX_HEIGHT - MENU_MARGIN, color2);
}


Expand Down Expand Up @@ -273,10 +285,28 @@ namespace Mod
{
std::vector<MenuItem*> menuItemsOnPage;

for(int menuItemIndex = Config::GetNumber("menu_items_per_page") * page; menuItemIndex < min((int)menuItems.size(), Config::GetNumber("menu_items_per_page") * (page + 1)); menuItemIndex++)
if(Config::GetText("menu_layout") == "classic")
{
for(int menuItemIndex = Config::GetNumber("menu_items_per_page") * page; menuItemIndex < min((int)menuItems.size(), Config::GetNumber("menu_items_per_page") * (page + 1)); menuItemIndex++)
{
MenuItem* menuItem = menuItems[menuItemIndex];
menuItemsOnPage.push_back(menuItem);
}
}
else if(Config::GetText("menu_layout") == "single_page")
{
MenuItem* menuItem = menuItems[menuItemIndex];
menuItemsOnPage.push_back(menuItem);
int index = Config::GetNumber("menu_items_per_page") * page + selectedMenuItemIndex;
int halfOfPage = (int)round(Config::GetNumber("menu_items_per_page") * 0.5);

for(
int menuItemIndex = max(0, index - halfOfPage + 1 - max(0, index + halfOfPage - (int)menuItems.size()));
menuItemIndex < min((int)menuItems.size(), index + halfOfPage - min(0, index - halfOfPage + 1));
menuItemIndex++
)
{
MenuItem* menuItem = menuItems[menuItemIndex];
menuItemsOnPage.push_back(menuItem);
}
}

return menuItemsOnPage;
Expand Down
2 changes: 1 addition & 1 deletion LunkyBox/Mod/Mod.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Mod
{
const char* const TITLE = "LunkyBox v1.0";
const char* const TITLE = "LunkyBox v1.3";
const char* const FONT = "Arial";
const char* const CONFIG_FILE = "config.txt";

Expand Down
Binary file modified LunkyBox/Release/BoolMenuItem.obj
Binary file not shown.
Binary file modified LunkyBox/Release/Config.obj
Binary file not shown.
Binary file modified LunkyBox/Release/D3d9.obj
Binary file not shown.
Binary file modified LunkyBox/Release/Drawing.obj
Binary file not shown.
Binary file modified LunkyBox/Release/ENTITY_CLASS.obj
Binary file not shown.
Binary file modified LunkyBox/Release/Entity.obj
Binary file not shown.
Binary file modified LunkyBox/Release/ITEM_CLASS.obj
Binary file not shown.
Binary file modified LunkyBox/Release/Input.obj
Binary file not shown.
Binary file modified LunkyBox/Release/IntMenuItem.obj
Binary file not shown.
Binary file modified LunkyBox/Release/KeyState.obj
Binary file not shown.
25 changes: 4 additions & 21 deletions LunkyBox/Release/LunkyBox.log
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
 Config.cpp
Module.cpp
BoolMenuItem.cpp
D3d9.cpp
Drawing.cpp
Entity.cpp
ENTITY_CLASS.cpp
Input.cpp
IntMenuItem.cpp
ITEM_CLASS.cpp
KeyState.cpp
Main.cpp
Memory.cpp
Menu.cpp
MenuItem.cpp
Mod.cpp
Player.cpp
Spelunky.cpp
Vector2.cpp
Window.cpp
 Menu.cpp
Generating code
All 4288 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
0 of 4290 functions ( 0.0%) were compiled, the rest were copied from previous compilation.
0 functions were new in current compilation
0 functions had inline decision re-evaluated but remain unchanged
Finished generating code
LunkyBox.vcxproj -> D:\Dropbox\Projects\C++\LunkyBox\Release\LunkyBox.dll
Binary file modified LunkyBox/Release/LunkyBox.tlog/CL.command.1.tlog
Binary file not shown.
Binary file modified LunkyBox/Release/LunkyBox.tlog/CL.read.1.tlog
Binary file not shown.
Binary file modified LunkyBox/Release/LunkyBox.tlog/CL.write.1.tlog
Binary file not shown.
Binary file modified LunkyBox/Release/LunkyBox.tlog/link.read.1.tlog
Binary file not shown.
Binary file modified LunkyBox/Release/LunkyBox.tlog/link.write.1.tlog
Binary file not shown.
Binary file modified LunkyBox/Release/Main.obj
Binary file not shown.
Binary file modified LunkyBox/Release/Memory.obj
Binary file not shown.
Binary file modified LunkyBox/Release/Menu.obj
Binary file not shown.
Binary file modified LunkyBox/Release/MenuItem.obj
Binary file not shown.
Binary file modified LunkyBox/Release/Mod.obj
Binary file not shown.
Binary file modified LunkyBox/Release/Module.obj
Binary file not shown.
Binary file modified LunkyBox/Release/Player.obj
Binary file not shown.
Binary file modified LunkyBox/Release/Spelunky.obj
Binary file not shown.
Binary file modified LunkyBox/Release/Vector2.obj
Binary file not shown.
Binary file modified LunkyBox/Release/Window.obj
Binary file not shown.
Binary file modified LunkyBox/Release/vc140.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion LunkyBoxGOG/Mod/BoolMenuItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace Mod
LPCSTR onOffText = isOn ? "ON" : "OFF";
int textWidth = Drawing::GetTextWidth(fontMenuItem, onOffText);

Drawing::DrawText(fontMenuItem, onOffText, Config::GetNumber("menu_x") + Config::GetNumber("menu_width") - textWidth - 4, Config::GetNumber("menu_y") + TITLE_BOX_HEIGHT + 6 + (ITEM_HEIGHT + MENU_MARGIN) * menuItemIndex, Config::GetNumber("menu_width") - MENU_MARGIN, ITEM_HEIGHT - MENU_MARGIN, parentMenu->selectedMenuItemIndex == menuItemIndex ? color2 : color1);
Drawing::DrawText(fontMenuItem, onOffText, Config::GetNumber("menu_x") + Config::GetNumber("menu_width") - textWidth - 4, Config::GetNumber("menu_y") + TITLE_BOX_HEIGHT + 6 + (ITEM_HEIGHT + MENU_MARGIN) * menuItemIndex, Config::GetNumber("menu_width") - MENU_MARGIN, ITEM_HEIGHT - MENU_MARGIN, IsInFocus() ? color2 : color1);
}

void BoolMenuItem::Select()
Expand Down
2 changes: 1 addition & 1 deletion LunkyBoxGOG/Mod/IntMenuItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace Mod
LPCSTR valueLPCSTR = valueString.c_str();
int textWidth = Drawing::GetTextWidth(fontMenuItem, valueLPCSTR);

Drawing::DrawText(fontMenuItem, valueLPCSTR, Config::GetNumber("menu_x") + Config::GetNumber("menu_width") - textWidth - 4, Config::GetNumber("menu_y") + TITLE_BOX_HEIGHT + 6 + (ITEM_HEIGHT + MENU_MARGIN) * menuItemIndex, Config::GetNumber("menu_width") - MENU_MARGIN, ITEM_HEIGHT - MENU_MARGIN, parentMenu->selectedMenuItemIndex == menuItemIndex ? color2 : color1);
Drawing::DrawText(fontMenuItem, valueLPCSTR, Config::GetNumber("menu_x") + Config::GetNumber("menu_width") - textWidth - 4, Config::GetNumber("menu_y") + TITLE_BOX_HEIGHT + 6 + (ITEM_HEIGHT + MENU_MARGIN) * menuItemIndex, Config::GetNumber("menu_width") - MENU_MARGIN, ITEM_HEIGHT - MENU_MARGIN, IsInFocus() ? color2 : color1);
}

void IntMenuItem::Select()
Expand Down
Loading

0 comments on commit 0b5f272

Please sign in to comment.