Unverified Commit d08e5f8e authored by Aapeli's avatar Aapeli

Remove space before open paren when invoking or defining function

parent 93c53151
......@@ -3,29 +3,29 @@
#include "classes.hpp"
namespace AapeliBlox {
Move::Move (int sx, int sy, int srotation, bool sjump) {
Move::Move(int sx, int sy, int srotation, bool sjump) {
x = sx; y = sy; rotation = srotation; jump = sjump; lastMove = 0;
}
void Move::restart (void) {
void Move::restart(void) {
lastMove = 0;
}
Vector::Vector (int sx, int sy) {
Vector::Vector(int sx, int sy) {
x = sx; y = sy;
}
Block::Block (sf::Color scolor, bool visible, bool sisUndoBlock) {
Block::Block(sf::Color scolor, bool visible, bool sisUndoBlock) {
color = scolor; isBlock = visible; isUndoBlock = sisUndoBlock;
}
ShapeBlock::ShapeBlock (sf::Color scolor, int sx, int sy) {
ShapeBlock::ShapeBlock(sf::Color scolor, int sx, int sy) {
x = sx; y = sy; color = scolor;
}
void Shape::updateExtrema (void) {
void Shape::updateExtrema(void) {
minx = 0; maxx = 0;
for (int i = 0; i < 4; i++) {
minx = std::min(minx, blocks[i].x);
maxx = std::max(maxx, blocks[i].x);
}
}
Shape::Shape (sf::Color scolor,
Shape::Shape(sf::Color scolor,
int x1, int y1,
int x2, int y2,
int x3, int y3,
......@@ -46,7 +46,7 @@ namespace AapeliBlox {
updateExtrema();
}
/** Rotate either 0, 90, 180, 270, etc degrees */
void Shape::rotate (int rotation) {
void Shape::rotate(int rotation) {
while (rotation < 0) {
rotation += 4;
}
......
......@@ -9,24 +9,24 @@ namespace AapeliBlox {
int x, y, rotation;
bool jump;
double lastMove;
Move (int sx = 0, int sy = 0, int srotation = 0, bool sjump = false);
void restart (void);
Move(int sx = 0, int sy = 0, int srotation = 0, bool sjump = false);
void restart(void);
};
const int blockSide = 30;
struct Vector {
int x, y;
Vector (int sx = 0, int sy = 0);
Vector(int sx = 0, int sy = 0);
};
struct Block {
sf::Color color;
bool isBlock;
bool isUndoBlock;
Block (sf::Color scolor = sf::Color::White, bool visible = false, bool sisUndoBlock = false);
Block(sf::Color scolor = sf::Color::White, bool visible = false, bool sisUndoBlock = false);
};
struct ShapeBlock {
sf::Color color;
int x, y;
ShapeBlock (sf::Color scolor = sf::Color::White, int sx = 0, int sy = 0);
ShapeBlock(sf::Color scolor = sf::Color::White, int sx = 0, int sy = 0);
};
struct Shape {
bool evenWide;
......@@ -35,7 +35,7 @@ namespace AapeliBlox {
int originx, originy;
sf::Color color;
Vector blocks[4];
Shape (sf::Color scolor = sf::Color(255,255,255,0),
Shape(sf::Color scolor = sf::Color(255,255,255,0),
int x1 = 0, int y1 = 0,
int x2 = 0, int y2 = 1,
int x3 = 0, int y3 = 2,
......@@ -44,9 +44,9 @@ namespace AapeliBlox {
bool soddThick = false,
int soriginx = 0,
int soriginy = 0);
void rotate (int rotation);
void rotate(int rotation);
private:
void updateExtrema (void);
void updateExtrema(void);
};
}
......
......@@ -14,7 +14,7 @@
#include "game.hpp"
namespace AapeliBlox {
Game::Game (states& sgameState,
Game::Game(states& sgameState,
RandomNumberGenerator& sRNG,
sf::Font& sdFont,
sf::Font& ssFont,
......@@ -175,12 +175,12 @@ namespace AapeliBlox {
// Timer
drawFeatureBox(featuresTimer.x, featuresTimer.y, featuresTimerDimensions.x, featuresTimerDimensions.y);
newGame (normal);
newGame(normal);
drawPoints();
drawTimer();
}
void Game::newGame (gameType newGameType) {
void Game::newGame(gameType newGameType) {
curGameType = newGameType;
gameState = inGame;
......@@ -225,21 +225,21 @@ namespace AapeliBlox {
spawnNewBlock();
}
void Game::restart (void) {
void Game::restart(void) {
newGame(curGameType);
}
void Game::doEffects (void) {
void Game::doEffects(void) {
if (effects.getElapsedTime().asSeconds() > effectInterval) {
effects.restart();
if (effectsPoints < totalPoints) {
effectsPoints += int ((totalPoints - effectsPoints + 1) / 2);
effectsPoints += int((totalPoints - effectsPoints + 1) / 2);
}
}
}
void Game::centerText (sf::Text& text, int x, int y) {
void Game::centerText(sf::Text& text, int x, int y) {
text.setPosition(x - text.getLocalBounds().width / 2, y);
}
void Game::drawFeatureBox (int x, int y, int width, int height) {
void Game::drawFeatureBox(int x, int y, int width, int height) {
featureOutline.append(sf::Vertex(sf::Vector2f(x, y), featureOutlineColor));
featureOutline.append(sf::Vertex(sf::Vector2f(x + width, y), featureOutlineColor));
featureOutline.append(sf::Vertex(sf::Vector2f(x + width, y + height), featureOutlineColor));
......@@ -254,21 +254,21 @@ namespace AapeliBlox {
featureBoxes.append(sf::Vertex(sf::Vector2f(x + width, y + height), featureBoxColor));
featureBoxes.append(sf::Vertex(sf::Vector2f(x, y + height), featureBoxColor));
}
void Game::calculatePoints (void) {
void Game::calculatePoints(void) {
totalPoints = points[0] * weights[0] +
points[1] * weights[1] +
points[2] * weights[2] +
points[3] * weights[3] +
points[4] * weights[4];
}
void Game::drawPoints (void) {
void Game::drawPoints(void) {
calculatePoints();
std::stringstream pointText;
pointText << std::setw(7) << std::setfill('0') << effectsPoints;
scoreTextNumbers.setString(pointText.str());
centerText (scoreTextNumbers, featuresYourScore.x + featureWidth / 2, featuresYourScore.y + 40);
centerText(scoreTextNumbers, featuresYourScore.x + featureWidth / 2, featuresYourScore.y + 40);
}
void Game::drawTimer (void) {
void Game::drawTimer(void) {
if (gameState == inGame) {
int secondsPlayed = std::floor(gameTimer.getElapsedTime().asSeconds());
int minutesPlayed = std::floor(secondsPlayed / secsInMin);
......@@ -287,7 +287,7 @@ namespace AapeliBlox {
gameTimePretty = timerTextMins.str().append(":").append(timerTextSecs.str());
timerTextNumbers.setString(gameTimePretty);
centerText (timerTextNumbers, featuresTimer.x + featureWidth / 2, featuresTimer.y + 40);
centerText(timerTextNumbers, featuresTimer.x + featureWidth / 2, featuresTimer.y + 40);
if (curGameType != normal && gameTimer.getElapsedTime().asSeconds() > gameTime - 0.1) {
if (curGameType == undoGame) {
......@@ -300,7 +300,7 @@ namespace AapeliBlox {
}
// Checks whether the block can go to a certain position
// a.k.a. whether there are any blocks at those places
bool Game::canBlockGo (Shape shape, Vector location) {
bool Game::canBlockGo(Shape shape, Vector location) {
bool cannotGo = false;
for (int i = 0; i < 4; i++) {
if (location.x + shape.blocks[i].x < 0 ||
......@@ -313,11 +313,11 @@ namespace AapeliBlox {
return !cannotGo;
}
// Helper function that does the same to a rotated block
bool Game::canBlockRotate (Shape shape, Vector location, int rotation) {
bool Game::canBlockRotate(Shape shape, Vector location, int rotation) {
shape.rotate(rotation);
return canBlockGo (shape, location);
return canBlockGo(shape, location);
}
void Game::move (Move& doMove) {
void Game::move(Move& doMove) {
if ((doMove.jump && moveTimer.getElapsedTime().asSeconds() - doMove.lastMove > 3 * minMoveInterval) || (!doMove.jump && moveTimer.getElapsedTime().asSeconds() - doMove.lastMove > minMoveInterval)) {
doMove.lastMove = moveTimer.getElapsedTime().asSeconds();
if (doMove.x != 0 || doMove.y != 0) {
......@@ -338,13 +338,13 @@ namespace AapeliBlox {
}
}
}
void Game::inputLeft (void) { move(left); }
void Game::inputRight (void) { move(right); }
void Game::inputDown (void) { move(down); }
void Game::inputRotateLeft (void) { move(rotateLeft); }
void Game::inputRotateRight (void) { move(rotateRight); }
void Game::inputJump (void) { move(jump); }
void Game::createUndoMap (void) {
void Game::inputLeft(void) { move(left); }
void Game::inputRight(void) { move(right); }
void Game::inputDown(void) { move(down); }
void Game::inputRotateLeft(void) { move(rotateLeft); }
void Game::inputRotateRight(void) { move(rotateRight); }
void Game::inputJump(void) { move(jump); }
void Game::createUndoMap(void) {
// Create some random blocks
for (int level = 0; level < undoHeight; level++) {
int blocksInRow = 0;
......@@ -359,7 +359,7 @@ namespace AapeliBlox {
}
}
}
void Game::placeGhost (void) {
void Game::placeGhost(void) {
int y = 0;
bool done = false;
// Check how far the block can move and move ghost there
......@@ -378,7 +378,7 @@ namespace AapeliBlox {
y++;
}
}
void Game::spawnNewBlock (void) {
void Game::spawnNewBlock(void) {
if (!canBlockGo(nextShape, Vector(blockTowerWidth / 2, blockTowerVisibleHeight - 1))) {
endGameLogic(tooManyBlocks);
} else {
......@@ -395,7 +395,7 @@ namespace AapeliBlox {
placeGhost();
}
}
void Game::drawBlock (int x, int y, sf::Color& color) {
void Game::drawBlock(int x, int y, sf::Color& color) {
if (y < blockTowerVisibleHeight) {
blockVertexArray.append(sf::Vertex(sf::Vector2f(min.x + x * blockSide, max.y - y * blockSide), color));
blockVertexArray.append(sf::Vertex(sf::Vector2f(min.x + (x + 1) * blockSide, max.y - y * blockSide), color));
......@@ -403,12 +403,12 @@ namespace AapeliBlox {
blockVertexArray.append(sf::Vertex(sf::Vector2f(min.x + x * blockSide, max.y - (y + 1) * blockSide), color));
}
}
void Game::drawShape (Shape& sh, Vector& loc) {
void Game::drawShape(Shape& sh, Vector& loc) {
for (int i = 0; i < 4; i++) {
drawBlock (sh.blocks[i].x + loc.x, sh.blocks[i].y + loc.y, sh.color);
drawBlock(sh.blocks[i].x + loc.x, sh.blocks[i].y + loc.y, sh.color);
}
}
void Game::drawNext (void) {
void Game::drawNext(void) {
nextVertexArray.clear();
nextGrid.clear();
......@@ -443,7 +443,7 @@ namespace AapeliBlox {
nextGrid.append(sf::Vertex(sf::Vector2f(center.x + (nextShape.blocks[i].x - 0.5 + addx) * blockSide, center.y - (nextShape.blocks[i].y + addy) * blockSide), gridLineColor));
}
}
void Game::checkRows (void) {
void Game::checkRows(void) {
int rows = 0;
// Recursively loop until got rid of all rows
int y = 0;
......@@ -476,13 +476,13 @@ namespace AapeliBlox {
}
points[rows]++;
}
void Game::dissolveCurrentBlock (void) {
void Game::dissolveCurrentBlock(void) {
// Dissolve the block into the field
for (int i = 0; i < 4; i++) {
blocks[currentLocation.x + currentShape.blocks[i].x][currentLocation.y + currentShape.blocks[i].y] = Block(currentShape.color, true);
}
}
void Game::placeBlock (void) {
void Game::placeBlock(void) {
dissolveCurrentBlock();
checkRows();
spawnNewBlock();
......@@ -500,7 +500,7 @@ namespace AapeliBlox {
}
}
}
void Game::endGameLogic (endType type) {
void Game::endGameLogic(endType type) {
calculatePoints();
switch (curGameType) {
case normal:
......@@ -529,7 +529,7 @@ namespace AapeliBlox {
scoreEntry.setText(std::string("Score: ").append(std::to_string(totalPoints)));
gameState = inEndBox;
}
void Game::gameLogic (void) {
void Game::gameLogic(void) {
if (gameState == inGame) {
if (drop.getElapsedTime().asSeconds() > dropInterval) {
drop.restart();
......@@ -552,17 +552,17 @@ namespace AapeliBlox {
for (int x = 0; x < blockTowerWidth; x++) {
for (int y = 0; y < blockTowerHeight; y++) {
if (blocks[x][y].isBlock) {
drawBlock (x, y, blocks[x][y].color);
drawBlock(x, y, blocks[x][y].color);
}
}
}
// Draw the current block
drawShape (currentShape, currentLocation);
drawShape(currentShape, currentLocation);
// Draw ghost block
if (drawGhost) {
drawShape (currentShapeGhost, currentLocationGhost);
drawShape(currentShapeGhost, currentLocationGhost);
}
drawNext();
......@@ -571,7 +571,7 @@ namespace AapeliBlox {
drawTimer();
}
void Game::draw (sf::RenderWindow& window) {
void Game::draw(sf::RenderWindow& window) {
window.draw(featureBoxes);
window.draw(featureOutline);
......@@ -590,7 +590,7 @@ namespace AapeliBlox {
window.draw(timerText);
window.draw(timerTextNumbers);
}
int Game::getPoints (void) {
int Game::getPoints(void) {
return totalPoints;
}
}
......@@ -97,26 +97,26 @@ namespace AapeliBlox {
MenuEntry &scoreEntry, &endEntry, &timeEntry;
void drawBlock (int x, int y, sf::Color& color);
void drawShape (Shape& sh, Vector& loc);
void drawNext (void);
void drawPoints (void);
void drawTimer (void);
void drawFeatureBox (int x, int y, int width, int height);
void placeGhost (void);
void checkRows (void);
bool canBlockGo (Shape shape, Vector location);
bool canBlockRotate (Shape shape, Vector location, int rotation);
void dissolveCurrentBlock (void);
void placeBlock (void);
void move (Move& doMove);
void centerText (sf::Text& text, int x, int y);
void doEffects (void);
void createUndoMap (void);
void calculatePoints (void);
void endGameLogic (endType type);
void drawBlock(int x, int y, sf::Color& color);
void drawShape(Shape& sh, Vector& loc);
void drawNext(void);
void drawPoints(void);
void drawTimer(void);
void drawFeatureBox(int x, int y, int width, int height);
void placeGhost(void);
void checkRows(void);
bool canBlockGo(Shape shape, Vector location);
bool canBlockRotate(Shape shape, Vector location, int rotation);
void dissolveCurrentBlock(void);
void placeBlock(void);
void move(Move& doMove);
void centerText(sf::Text& text, int x, int y);
void doEffects(void);
void createUndoMap(void);
void calculatePoints(void);
void endGameLogic(endType type);
public:
Game (states& sgameState,
Game(states& sgameState,
RandomNumberGenerator& sRNG,
sf::Font& sdFont,
sf::Font& ssFont,
......@@ -136,18 +136,18 @@ namespace AapeliBlox {
double sminMoveInterval = 0.1,
sf::Color empty = sf::Color(255, 0, 255, 150),
sf::Color undo = sf::Color(23, 47, 66, 255));
void newGame (gameType newGameType);
void spawnNewBlock (void);
void gameLogic (void);
void draw (sf::RenderWindow& window);
void inputLeft (void);
void inputRight (void);
void inputDown (void);
void inputRotateLeft (void);
void inputRotateRight (void);
void inputJump (void);
int getPoints (void);
void restart (void);
void newGame(gameType newGameType);
void spawnNewBlock(void);
void gameLogic(void);
void draw(sf::RenderWindow& window);
void inputLeft(void);
void inputRight(void);
void inputDown(void);
void inputRotateLeft(void);
void inputRotateRight(void);
void inputJump(void);
int getPoints(void);
void restart(void);
};
}
......
......@@ -7,19 +7,19 @@
#include "menu.hpp"
namespace AapeliBlox {
MenuEntry::MenuEntry (std::string stext, bool sclickable) {
MenuEntry::MenuEntry(std::string stext, bool sclickable) {
text = stext; clickable = sclickable;
}
void MenuEntry::setText (std::string stext) {
void MenuEntry::setText(std::string stext) {
text = stext;
}
MenuScreen::MenuText::MenuText (sf::Text ssfText, MenuEntry* sentry) {
MenuScreen::MenuText::MenuText(sf::Text ssfText, MenuEntry* sentry) {
sfText = ssfText; entry = sentry;
}
MenuScreen::MenuScreen (void) {
MenuScreen::MenuScreen(void) {
// Do nothing
}
MenuScreen::MenuScreen (sf::Font& sfont,
MenuScreen::MenuScreen(sf::Font& sfont,
std::vector<MenuEntry*> menuEntries,
int scharSize,
int smaxx,
......@@ -49,7 +49,7 @@ namespace AapeliBlox {
sfText.setCharacterSize(scharSize);
sfText.setColor(textColor);
sfText.setString(menuEntries[i]->text);
lineHeight = std::max(int (lineHeight), int (sfText.getLocalBounds().height));
lineHeight = std::max(int(lineHeight), int(sfText.getLocalBounds().height));
entries.push_back(MenuText(sfText, menuEntries[i]));
}
......@@ -59,7 +59,7 @@ namespace AapeliBlox {
}
}
}
bool MenuScreen::checkHover (int x, int y) {
bool MenuScreen::checkHover(int x, int y) {
for (int i = 0; i < entries.size(); i++) {
if (entries[i].sfText.getGlobalBounds().contains(x, y) && entries[i].entry->clickable) {
selected = i;
......@@ -68,12 +68,12 @@ namespace AapeliBlox {
}
return false;
}
void MenuScreen::changeSelection (int dir) {
void MenuScreen::changeSelection(int dir) {
if (selected + dir >= 0 && selected + dir < entries.size() && entries[selected + dir].entry->clickable) {
selected += dir;
}
}
void MenuScreen::draw (sf::RenderWindow& window) {
void MenuScreen::draw(sf::RenderWindow& window) {
// Draw background
window.draw(bgStrip);
......@@ -89,7 +89,7 @@ namespace AapeliBlox {
drawAt += (lineHeight + padding);
}
}
MenuEntry* MenuScreen::getSelected (void) {
MenuEntry* MenuScreen::getSelected(void) {
return entries[selected].entry;
}
}
......@@ -10,14 +10,14 @@ namespace AapeliBlox {
struct MenuEntry {
std::string text;
bool clickable;
MenuEntry (std::string stext = "", bool sclickable = true);
void setText (std::string stext);
MenuEntry(std::string stext = "", bool sclickable = true);
void setText(std::string stext);
};
class MenuScreen {
struct MenuText {
sf::Text sfText;
MenuEntry* entry;
MenuText (sf::Text ssfText, MenuEntry* sentry);
MenuText(sf::Text ssfText, MenuEntry* sentry);
};
int maxx, maxy, centerx, centery;
int bgHeight, padding;
......@@ -27,16 +27,16 @@ namespace AapeliBlox {
std::vector<MenuText> entries;
sf::VertexArray bgStrip;
public:
MenuScreen (void);
MenuScreen (sf::Font& sfont,
MenuScreen(void);
MenuScreen(sf::Font& sfont,
std::vector<MenuEntry*> menuEntries,
int scharSize,
int smaxx,
int smaxy);
bool checkHover (int x, int y);
void draw (sf::RenderWindow& window);
void changeSelection (int dir);
MenuEntry* getSelected (void);
bool checkHover(int x, int y);
void draw(sf::RenderWindow& window);
void changeSelection(int dir);
MenuEntry* getSelected(void);
};
}
......
......@@ -9,7 +9,7 @@
#include "resources/bloxLogo.hpp"
namespace AapeliBlox {
MenuHandler::MenuHandler (states& sgameState, sf::Font& menuFont, int width, int height) : gameState(sgameState) {
MenuHandler::MenuHandler(states& sgameState, sf::Font& menuFont, int width, int height) : gameState(sgameState) {
selected = 0;
// Let's make some menus!
......@@ -95,7 +95,7 @@ namespace AapeliBlox {
logoSprite.setTexture(logoTexture);
logoSprite.setPosition(width / 2 - bloxLogo.width / 2, width / 2 - 100);
}
MenuScreen* MenuHandler::currentMenu (void) {
MenuScreen* MenuHandler::currentMenu(void) {
switch (gameState) {
case inMainMenu:
return &mainMenu;
......@@ -111,23 +111,23 @@ namespace AapeliBlox {
return 0;
}
}
void MenuHandler::mouseMoved (int x, int y) {
void MenuHandler::mouseMoved(int x, int y) {
currentMenu()->checkHover(x, y);
}
void MenuHandler::mouseClicked (int x, int y) {
void MenuHandler::mouseClicked(int x, int y) {
currentMenu()->checkHover(x, y);
selected = currentMenu()->getSelected();
}
void MenuHandler::inputUp (void) {
void MenuHandler::inputUp(void) {
currentMenu()->changeSelection(-1);
}
void MenuHandler::inputDown (void) {
void MenuHandler::inputDown(void) {
currentMenu()->changeSelection(1);
}
void MenuHandler::inputEnter (void) {
void MenuHandler::inputEnter(void) {
selected = currentMenu()->getSelected();
}
void MenuHandler::inputEsc (void) {
void MenuHandler::inputEsc(void) {
switch (gameState) {
case inContinueMenu:
selected = &Continue; break;
......@@ -137,7 +137,7 @@ namespace AapeliBlox {
selected = &Back; break;
}
}
selectionOutcome MenuHandler::processSelection (void) {
selectionOutcome MenuHandler::processSelection(void) {
MenuEntry* temp = selected;
selected = 0;
if (temp == &Singleplayer) { return goToNewGameMenu; }
......@@ -153,19 +153,19 @@ namespace AapeliBlox {
else if (temp == &Back) { return goToMainMenu; }
else { return doNothing; }
}
void MenuHandler::draw (sf::RenderWindow& window) {
void MenuHandler::draw(sf::RenderWindow& window) {
if (gameState != inGame) {
currentMenu()->draw(window);
window.draw(logoSprite);
}
}
MenuEntry& MenuHandler::getEndTextEntry (void) {
MenuEntry& MenuHandler::getEndTextEntry(void) {
return EndGameText;
}
MenuEntry& MenuHandler::getEndScoreEntry (void) {
MenuEntry& MenuHandler::getEndScoreEntry(void) {
return EndGameScore;
}
MenuEntry& MenuHandler::getEndTimeEntry (void) {
MenuEntry& MenuHandler::getEndTimeEntry(void) {
return EndGameTime;
}
}
......
......@@ -43,19 +43,19 @@ namespace AapeliBlox {
EndGameTime, EndGameScore;
MenuEntry About0, About1, About2, About3, About4, EmptyLine, Back;
public:
MenuHandler (states& sgameState, sf::Font& menuFont, int width, int height);
MenuScreen* currentMenu (void);
void mouseMoved (int x, int y);
void mouseClicked (int x, int y);
void inputUp (void);
void inputDown (void);
void inputEnter (void);
void inputEsc (void);
selectionOutcome processSelection (void);
void draw (sf::RenderWindow& window);
MenuEntry& getEndTextEntry (void);
MenuEntry& getEndScoreEntry (void);
MenuEntry& getEndTimeEntry (void);
MenuHandler(states& sgameState, sf::Font& menuFont, int width, int height);
MenuScreen* currentMenu(void);
void mouseMoved(int x, int y);
void mouseClicked(int x, int y);
void inputUp(void);
void inputDown(void);
void inputEnter(void);
void inputEsc(void);
selectionOutcome processSelection(void);
void draw(sf::RenderWindow& window);
MenuEntry& getEndTextEntry(void);
MenuEntry& getEndScoreEntry(void);
MenuEntry& getEndTimeEntry(void);
};
}
......
......@@ -3,7 +3,7 @@
#include "random.hpp"
namespace AapeliBlox {
RandomNumberGenerator::RandomNumberGenerator (int seed, int blockTowerWidth) {
RandomNumberGenerator::RandomNumberGenerator(int seed, int blockTowerWidth) {
currentSeed = seed;
// Seed the Mersenne Twister with a real random number
......@@ -22,23 +22,23 @@ namespace AapeliBlox {
// Randomly rotate the next block
rRotation = std::uniform_int_distribution<int>(0, 3);
}
void RandomNumberGenerator::reSeed (int seed) {
void RandomNumberGenerator::reSeed(int seed) {
currentSeed = seed;
rMersenneTwister = std::mt19937(currentSeed);
}
bool RandomNumberGenerator::createBlock (void) {
bool RandomNumberGenerator::createBlock(void) {
return rCreateBlock(rMersenneTwister);
}
int RandomNumberGenerator::blockDestroy (void) {
int RandomNumberGenerator::blockDestroy(void) {
return rBlockDestroy(rMersenneTwister);
}
int RandomNumberGenerator::block (void) {
int RandomNumberGenerator::block(void) {
return rBlock(rMersenneTwister);
}
int RandomNumberGenerator::rotation (void) {
int RandomNumberGenerator::rotation(void) {
return rRotation(rMersenneTwister);
}
int RandomNumberGenerator::getSeed (void) {
int RandomNumberGenerator::getSeed(void) {
return currentSeed;
}
}
......@@ -12,13 +12,13 @@ namespace AapeliBlox {
std::uniform_int_distribution<int> rRotation;
int currentSeed;
public:
RandomNumberGenerator (int seed, int blockTowerWidth = 1);
void reSeed (int seed);
bool createBlock (void);
int blockDestroy (void);
int block (void);
int rotation (void);
int getSeed (void);
RandomNumberGenerator(int seed, int blockTowerWidth = 1);
void reSeed(int seed);
bool createBlock(void);
int blockDestroy(void);
int block(void);
int rotation(void);
int getSeed(void);
};
}
......
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