-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from bluecadet/feature/clang-format
Create Cinder app template; integrate ClangFormat
- Loading branch information
Showing
4 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,4 +30,5 @@ | |
|
||
<includePath>src</includePath> | ||
</block> | ||
<template>templates/Bluecadet App/template.xml</template> | ||
</cinder> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
AccessModifierOffset: '-4' | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: 'true' | ||
AlignConsecutiveDeclarations: 'false' | ||
AlignEscapedNewlines: Right | ||
AlignOperands: 'true' | ||
AlignTrailingComments: 'true' | ||
AllowAllParametersOfDeclarationOnNextLine: 'true' | ||
AllowShortBlocksOnASingleLine: 'false' | ||
AllowShortCaseLabelsOnASingleLine: 'false' | ||
AllowShortFunctionsOnASingleLine: InlineOnly | ||
AllowShortIfStatementsOnASingleLine: 'false' | ||
AllowShortLoopsOnASingleLine: 'false' | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: 'false' | ||
AlwaysBreakTemplateDeclarations: 'true' | ||
BinPackArguments: 'false' | ||
BinPackParameters: 'false' | ||
BreakBeforeBinaryOperators: NonAssignment | ||
BreakBeforeBraces: Attach | ||
BreakBeforeInheritanceComma: 'false' | ||
BreakBeforeTernaryOperators: 'false' | ||
BreakConstructorInitializers: AfterColon | ||
BreakStringLiterals: 'true' | ||
ColumnLimit: '95' | ||
CompactNamespaces: 'false' | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true' | ||
Cpp11BracedListStyle: 'true' | ||
DerivePointerAlignment: 'false' | ||
DisableFormat: 'false' | ||
FixNamespaceComments: 'true' | ||
IndentCaseLabels: 'false' | ||
IndentWidth: '4' | ||
IndentWrappedFunctionNames: 'false' | ||
KeepEmptyLinesAtTheStartOfBlocks: 'false' | ||
Language: Cpp | ||
NamespaceIndentation: None | ||
PointerAlignment: Right | ||
ReflowComments: 'false' | ||
SortIncludes: 'true' | ||
SortUsingDeclarations: 'true' | ||
SpaceAfterCStyleCast: 'false' | ||
SpaceAfterTemplateKeyword: 'false' | ||
SpaceBeforeAssignmentOperators: 'true' | ||
SpaceBeforeParens: ControlStatements | ||
SpaceInEmptyParentheses: 'false' | ||
SpacesBeforeTrailingComments: '4' | ||
SpacesInAngles: 'false' | ||
SpacesInCStyleCastParentheses: 'false' | ||
SpacesInContainerLiterals: 'false' | ||
SpacesInParentheses: 'false' | ||
SpacesInSquareBrackets: 'false' | ||
Standard: Cpp11 | ||
TabWidth: '4' | ||
UseTab: Always | ||
|
||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Cinder | ||
#include "cinder/app/App.h" | ||
#include "cinder/app/RendererGl.h" | ||
#include "cinder/gl/gl.h" | ||
|
||
// Bluecadet | ||
#include "bluecadet/core/BaseApp.h" | ||
#include "bluecadet/views/TouchView.h" | ||
|
||
using namespace std; | ||
using namespace ci; | ||
using namespace ci::app; | ||
using namespace bluecadet::core; | ||
using namespace bluecadet::views; | ||
using namespace bluecadet::touch; | ||
|
||
class _TBOX_PREFIX_App : public BaseApp { | ||
public: | ||
static void prepareSettings(ci::app::App::Settings *settings); | ||
void setup() override; | ||
void update() override; | ||
void draw() override; | ||
}; | ||
|
||
void _TBOX_PREFIX_App::prepareSettings(ci::app::App::Settings *settings) { | ||
// Optional: Override the shared settings manager instance with your subclass | ||
// SettingsManager::setInstance(myApp::MyAppSettingsManager::getInstance()); | ||
|
||
// Initialize the settings manager with the cinder app settings and the settings json | ||
SettingsManager::getInstance()->setup( | ||
settings, | ||
ci::app::getAssetPath("settings.json"), | ||
[](SettingsManager *manager) { | ||
// Optional: Override json defaults at runtime | ||
manager->mFullscreen = false; | ||
manager->mWindowSize = ivec2(1280, 720); | ||
}); | ||
} | ||
|
||
void _TBOX_PREFIX_App::setup() { | ||
BaseApp::setup(); | ||
|
||
// Optional: configure your root view | ||
getRootView()->setBackgroundColor(Color::gray(0.5f)); | ||
|
||
// Sample content | ||
auto button = make_shared<TouchView>(); | ||
button->setPosition(vec2(400, 300)); | ||
button->setSize(vec2(200, 100)); | ||
button->setBackgroundColor(Color(1, 0, 0)); | ||
button->getSignalTapped().connect( | ||
[=](bluecadet::touch::TouchEvent e) { CI_LOG_I("Button tapped"); }); | ||
getRootView()->addChild(button); | ||
} | ||
|
||
void _TBOX_PREFIX_App::update() { | ||
// Optional override. BaseApp::update() will update all views. | ||
BaseApp::update(); | ||
} | ||
|
||
void _TBOX_PREFIX_App::draw() { | ||
// Optional override. BaseApp::draw() will draw all views. | ||
BaseApp::draw(); | ||
} | ||
|
||
// Make sure to pass a reference to prepareSettings to configure the app correctly. MSAA and other render options are optional. | ||
CINDER_APP(_TBOX_PREFIX_App, | ||
RendererGl(RendererGl::Options().msaa(4)), | ||
_TBOX_PREFIX_App::prepareSettings); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<cinder> | ||
<template name="Bluecadet App" parent="org.libcinder.apptemplates.basicopengl"> | ||
<requires>com.bluecadet.cinder.views</requires> | ||
<source replaceContents="true" replaceName="true">src/_TBOX_PREFIX_App.cpp</source> | ||
<file>src/.clang-format</file> | ||
</template> | ||
</cinder> |