Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
192 changes: 192 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
---
Language: Cpp
# BasedOnStyle: Microsoft
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: Never
AfterEnum: false
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
QualifierAlignment: Leave
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
PackConstructorInitializers: BinPack
BasedOnStyle: ''
ConstructorInitializerAllOnOneLineOrOnePerLine: false
AllowAllConstructorInitializersOnNextLine: true
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 1000
PenaltyIndentedWhitespace: 0
PointerAlignment: Right
PPIndentWidth: -1
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
BeforeNonEmptyParentheses: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 4
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...

5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
INCDIRS = -Iinclude
CXX = skm g++ $(INCDIRS)
src = $(wildcard src/*.cpp)
headers = $(wildcard include/*.h)
obj = $(src:.cpp=.o)

LDFLAGS = -std=c++14
Expand All @@ -21,3 +22,7 @@ ArcadeMachine: $(obj)

clean:
rm $(obj)

format:
clang-format -i $(src)
clang-format -i $(headers)
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ cd arcade-machine
make
./ArcadeMachine
```

Subsequent builds (as you change code) can be completed by using just `make`. If you need to run a clean build again, you can use `make clean` first proceeded by `make`.

## Building arcade machine (manually)
+ Compile the application with the command ```skm clang++ src/* -Iinclude -lstdc++fs -o test```
+ Run the application ```./test```

## Contributing code and running the code formatter
Have a read of [CONTRIBUTING.md](CONTRIBUTING.md) to see the general code style conventions followed throughout the project.

Automatic code formatting is supported using `clang-format` (you may need to install this if you want to use it).

To run the code formatter on the whole project, execute `make format`.
39 changes: 21 additions & 18 deletions include/ArcadeMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@
#define ARCADE_MACHINE_RES_Y 1080 * ARCADE_MACHINE_SCALING_FACTOR

// Arcade Machine Class
#include "Audio.h"
#include "Button.h"
#include "MenuButton.h"
#include "GameScreenButton.h"
#include "ButtonNode.h"
#include "Cell.h"
#include "ConfigData.h"
#include "GameScreenButton.h"
#include "GridLayout.h"
#include "Cell.h"
#include "Helper.h"
#include "Menu.h"
#include "MenuButton.h"
#include "Option.h"
#include "Audio.h"
#include "Splashscreen.h"
#include "Selector.h"
#include "Splashscreen.h"
#include "splashkit.h"
#include <fstream>
#include <string>
#include <vector>
#include <fstream>

// Define number of rows and columns in grid
#define ROWS 7
#define COLS 15

/*
/*
This class handles the creation of the
Arcade Machine itself
*/
Expand All @@ -51,10 +51,10 @@ class ArcadeMachine
std::vector<ConfigData> m_configs;

/// Vector of MenuButtons
std::vector<Button*> m_menuBtns;
std::vector<Button *> m_menuBtns;

/// Vector of GameScreenButtons
std::vector<Button*> m_gameBtns;
std::vector<Button *> m_gameBtns;

/// Thoth Tech Company intro
Splashscreen m_introThothTech;
Expand All @@ -80,7 +80,7 @@ class ArcadeMachine
/// Mouse pointer
point_2d m_mouse;

/// Button Action
/// Button Action
std::string m_action;

/// Turn menu music on/off
Expand All @@ -91,10 +91,11 @@ class ArcadeMachine

// Helper function to load developer names into m_arcadeTeamDeveloperNames
// Called in the constructor
void loadDeveloperNames(const char* filePath);
void loadDeveloperNames(const char *filePath);

/// Check for Options menu exit
/// Check for Options menu exit
bool m_exitOptions = false;

public:
// Default Constructor
ArcadeMachine();
Expand All @@ -103,11 +104,14 @@ class ArcadeMachine
~ArcadeMachine();

// Getters
auto get_configs() const -> const vector<ConfigData>& { return this->m_configs; }

void mainMenu(); // Starts the Main Menu
void gamesMenu(); // Starts the Games Menu
void optionsMenu(); // Starts the Options Menu
auto get_configs() const -> const vector<ConfigData> &
{
return this->m_configs;
}

void mainMenu(); // Starts the Main Menu
void gamesMenu(); // Starts the Games Menu
void optionsMenu(); // Starts the Options Menu
void buttonClicked(point_2d point); // Checks for buttons clicked
void drawMainMenu();
void prepareMainMenu();
Expand All @@ -116,7 +120,6 @@ class ArcadeMachine
void playSplashKitIntro(); // Draws the Splashkit Productions logo to the screen and fetches new games from Git repo
void printConfigs();
void exitProgram();

};

#endif
Loading