git repos / blockattack-game

commit d2ba3cf5

sago007 · 2018-05-13 15:00
d2ba3cf5cec0969435a4dc33a3d76677a9ca9f89 patch · browse files
parent 5dfe56da046e459d7a21d8857c365c0b6608d04a

Run astyle on the source

Changed files

M source/code/DialogBox.cpp before
M source/code/HelpAboutState.cpp before
M source/code/HelpGamepadState.cpp before
M source/code/HelpHowtoState.cpp before
M source/code/MenuSystem.cpp before
M source/code/ScoresDisplay.cpp before
M source/code/main.cpp before
diff --git a/source/code/DialogBox.cpp b/source/code/DialogBox.cpp index 136d9cc..797aa86 100644 --- a/source/code/DialogBox.cpp +++ b/source/code/DialogBox.cpp
@@ -26,7 +26,7 @@ http://www.blockattack.net
#include "common.h"
#include "ReadKeyboard.h"
-static void setButtonFont(const sago::SagoDataHolder* holder, sago::SagoTextField& field, const char* text){
+static void setButtonFont(const sago::SagoDataHolder* holder, sago::SagoTextField& field, const char* text) {
field.SetHolder(holder);
field.SetFont("freeserif");
field.SetColor({255,255,255,255});
diff --git a/source/code/HelpAboutState.cpp b/source/code/HelpAboutState.cpp index 46acdcb..a0376fc 100644 --- a/source/code/HelpAboutState.cpp +++ b/source/code/HelpAboutState.cpp
@@ -35,7 +35,7 @@ extern sago::SagoSprite bExit;
-static void setHelpGamepadFont(const sago::SagoDataHolder* holder, sago::SagoTextField& field, const char* text){
+static void setHelpGamepadFont(const sago::SagoDataHolder* holder, sago::SagoTextField& field, const char* text) {
field.SetHolder(holder);
field.SetFont("freeserif");
field.SetColor({255,255,255,255});
@@ -44,7 +44,7 @@ static void setHelpGamepadFont(const sago::SagoDataHolder* holder, sago::SagoTex
field.SetText(text);
}
-static void setHelpGamepadFont(const sago::SagoDataHolder* holder, sago::SagoTextBox& field, const char* text){
+static void setHelpGamepadFont(const sago::SagoDataHolder* holder, sago::SagoTextBox& field, const char* text) {
field.SetHolder(holder);
field.SetFont("freeserif");
field.SetColor({255,255,255,255});
@@ -120,8 +120,8 @@ void HelpAboutState::Update() {
bMouseUp = false;
//The Score button:
- if ((globalData.mousex>xsize-buttonOffset) && (globalData.mousex<xsize-buttonOffset+bExit.GetWidth())
- && (globalData.mousey>ysize-buttonOffset) && (globalData.mousey<ysize-buttonOffset+bExit.GetHeight())) {
+ if ((globalData.mousex>xsize-buttonOffset) && (globalData.mousex<xsize-buttonOffset+bExit.GetWidth())
+ && (globalData.mousey>ysize-buttonOffset) && (globalData.mousey<ysize-buttonOffset+bExit.GetHeight())) {
isActive = false;
}
diff --git a/source/code/HelpGamepadState.cpp b/source/code/HelpGamepadState.cpp index d4db76b..a0ede06 100644 --- a/source/code/HelpGamepadState.cpp +++ b/source/code/HelpGamepadState.cpp
@@ -31,7 +31,7 @@ const int xsize = 1024;
const int ysize = 768;
const int buttonOffset = 160;
-static void setHelpGamepadFont(const sago::SagoDataHolder* holder, sago::SagoTextField& field, const char* text){
+static void setHelpGamepadFont(const sago::SagoDataHolder* holder, sago::SagoTextField& field, const char* text) {
field.SetHolder(holder);
field.SetFont("freeserif");
field.SetColor({255,255,255,255});
@@ -40,7 +40,7 @@ static void setHelpGamepadFont(const sago::SagoDataHolder* holder, sago::SagoTex
field.SetText(text);
}
-static void setHelpGamepadFont(const sago::SagoDataHolder* holder, sago::SagoTextBox& field, const char* text){
+static void setHelpGamepadFont(const sago::SagoDataHolder* holder, sago::SagoTextBox& field, const char* text) {
field.SetHolder(holder);
field.SetFont("freeserif");
field.SetColor({255,255,255,255});
@@ -108,7 +108,7 @@ void HelpGamepadState::Draw(SDL_Renderer* target) {
confirmLabel.Draw(target, 900, 404+30, sago::SagoTextField::Alignment::center);
bExit.Draw(globalData.screen, SDL_GetTicks(), xsize-buttonOffset, ysize-buttonOffset);
supportedControllers.Draw(target, 10, 600);
-
+
#if DEBUG
static sago::SagoTextField mousePos;
mousePos.SetHolder(&globalData.spriteHolder->GetDataHolder());
@@ -129,8 +129,8 @@ void HelpGamepadState::Update() {
bMouseUp = false;
//The Score button:
- if ((globalData.mousex>xsize-buttonOffset) && (globalData.mousex<xsize-buttonOffset+bExit.GetWidth())
- && (globalData.mousey>ysize-buttonOffset) && (globalData.mousey<ysize-buttonOffset+bExit.GetHeight())) {
+ if ((globalData.mousex>xsize-buttonOffset) && (globalData.mousex<xsize-buttonOffset+bExit.GetWidth())
+ && (globalData.mousey>ysize-buttonOffset) && (globalData.mousey<ysize-buttonOffset+bExit.GetHeight())) {
isActive = false;
}
diff --git a/source/code/HelpHowtoState.cpp b/source/code/HelpHowtoState.cpp index dc1ab73..075868c 100644 --- a/source/code/HelpHowtoState.cpp +++ b/source/code/HelpHowtoState.cpp
@@ -37,7 +37,7 @@ extern sago::SagoSprite bricks[7];
* Draws bricks with a string like:
* "aab" for two identical one and another
* "aaB" the third one will have a bomb
- * The any char not in 'a' to 'g' or 'A' to 'G' the behavior is undefined.
+ * The any char not in 'a' to 'g' or 'A' to 'G' the behavior is undefined.
* @param target Target to draw to
* @param bricks description on what to draw as a string
* @param x
@@ -68,21 +68,21 @@ public:
int state = 0; //0=move left, 1 = switch, 2 = move right, 3 = switch
Uint32 lastTick = 0;
Uint32 animationSpeed = 2000;
-
+
void Update (Uint32 tick) {
if (tick > lastTick + animationSpeed) {
lastTick = tick;
switch (state) {
- case 0:
- cursorPos = 1;
- break;
- case 1: //fallthough
- case 3:
- std::swap(brickStr[cursorPos], brickStr[cursorPos + 1]);
- break;
- case 2:
- cursorPos = 0;
- break;
+ case 0:
+ cursorPos = 1;
+ break;
+ case 1: //fallthough
+ case 3:
+ std::swap(brickStr[cursorPos], brickStr[cursorPos + 1]);
+ break;
+ case 2:
+ cursorPos = 0;
+ break;
}
++state;
if (state > 3) {
@@ -100,13 +100,13 @@ public:
lines.push_back(line);
return *this;
}
-
+
void Render(SDL_Renderer* target, int x, int y) {
for (size_t i = 0; i < lines.size(); ++i) {
RenderRowOfBricks(target, lines[i], x, y+i*50);
}
}
-
+
};
HorizontalSwitchAnimation switchAnimation;
@@ -221,8 +221,8 @@ void HelpHowtoState::Update() {
bMouseUp = false;
//The Score button:
- if ((globalData.mousex>xsize-buttonOffset) && (globalData.mousex<xsize-buttonOffset+bExit.GetWidth())
- && (globalData.mousey>ysize-buttonOffset) && (globalData.mousey<ysize-buttonOffset+bExit.GetHeight())) {
+ if ((globalData.mousex>xsize-buttonOffset) && (globalData.mousex<xsize-buttonOffset+bExit.GetWidth())
+ && (globalData.mousey>ysize-buttonOffset) && (globalData.mousey<ysize-buttonOffset+bExit.GetHeight())) {
isActive = false;
}
diff --git a/source/code/MenuSystem.cpp b/source/code/MenuSystem.cpp index a548157..4fe273e 100644 --- a/source/code/MenuSystem.cpp +++ b/source/code/MenuSystem.cpp
@@ -113,8 +113,8 @@ static void drawToScreen(const Button& b) {
globalData.spriteHolder->GetSprite(menu_unmarked).Draw(globalData.screen, SDL_GetTicks(), b.x, b.y);
}
- standardButton.getLabel(b.label)->Draw(globalData.screen, b.x+standardButton.xsize/2,b.y+standardButton.ysize/2,
- sago::SagoTextField::Alignment::center, sago::SagoTextField::VerticalAlignment::center);
+ standardButton.getLabel(b.label)->Draw(globalData.screen, b.x+standardButton.xsize/2,b.y+standardButton.ysize/2,
+ sago::SagoTextField::Alignment::center, sago::SagoTextField::VerticalAlignment::center);
//standardButton.thefont->drawCenterAlsoHeight(globalData.screen, b.x+standardButton.xsize/2,b.y+standardButton.ysize/2, b.label);
}
diff --git a/source/code/ScoresDisplay.cpp b/source/code/ScoresDisplay.cpp index 8c99a93..09ecc78 100644 --- a/source/code/ScoresDisplay.cpp +++ b/source/code/ScoresDisplay.cpp
@@ -31,7 +31,7 @@ using std::string;
using std::cerr;
using std::vector;
-static void setButtonFont(const sago::SagoDataHolder* holder, sago::SagoTextField& field, const char* text){
+static void setButtonFont(const sago::SagoDataHolder* holder, sago::SagoTextField& field, const char* text) {
field.SetHolder(holder);
field.SetFont("freeserif");
field.SetColor({255,255,255,255});
diff --git a/source/code/main.cpp b/source/code/main.cpp index 79dfb45..e55ea41 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp
@@ -180,7 +180,7 @@ static int InitImages(sago::SagoSpriteHolder& holder) {
bRetry = holder.GetSprite("b_blank");
globalData.mouse = holder.GetSprite("mouse");
backBoard = holder.GetSprite("back_board");
-
+
sagoTextSetBlueFont(player1name);
sagoTextSetBlueFont(player2name);
sagoTextSetBlueFont(player1time);
@@ -191,7 +191,7 @@ static int InitImages(sago::SagoSpriteHolder& holder) {
sagoTextSetBlueFont(player2chain);
sagoTextSetBlueFont(player1speed);
sagoTextSetBlueFont(player2speed);
-
+
//Loads the sound if sound present
if (!globalData.NoSound) {
@@ -414,19 +414,19 @@ static void DrawBalls() {
DrawIMG(iChainFrame,globalData.screen,x,y);
getSmallInt(globalData.theTextManager.textArray[i].getText())->Draw(globalData.screen, x+12, y+7,
- sago::SagoTextField::Alignment::center);
+ sago::SagoTextField::Alignment::center);
}
}
} //DrawBalls
-template <class T> void sagoTextSetHelpFont(T& field){
+template <class T> void sagoTextSetHelpFont(T& field) {
field.SetHolder(&globalData.spriteHolder->GetDataHolder());
field.SetFont("freeserif");
field.SetFontSize(30);
field.SetOutline(1, {128,128,128,255});
}
-void sagoTextSetHelpFont(sago::SagoTextField& gametypeNameField){
+void sagoTextSetHelpFont(sago::SagoTextField& gametypeNameField) {
sagoTextSetHelpFont<sago::SagoTextField>(gametypeNameField);
}
@@ -561,8 +561,8 @@ void DrawEverything(int xsize, int ysize,BlockGameSdl* theGame, BlockGameSdl* th
//Write the keys that are in use
int y = theGame2->GetTopY()+400;
std::string controldBoxText = std::string(_("Movement keys:"))+"\n"+getKeyName(keySettings[0].left)+", "+getKeyName(keySettings[0].right)+",\n"
- + getKeyName(keySettings[0].up)+", "+getKeyName(keySettings[0].down)+"\n"
- + _("Switch: ") + getKeyName(keySettings[0].change);
+ + getKeyName(keySettings[0].up)+", "+getKeyName(keySettings[0].down)+"\n"
+ + _("Switch: ") + getKeyName(keySettings[0].change);
if (theGame->isPuzzleMode()) {
controldBoxText += std::string("\n") + _("Restart: ")+getKeyName(keySettings[0].push);
}