Skip to content

Commit

Permalink
Merge branch 'release/1.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Bojko committed Dec 1, 2017
2 parents f62bc91 + c932770 commit 26018ba
Show file tree
Hide file tree
Showing 30 changed files with 557 additions and 472 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,4 @@ $RECYCLE.BIN/
._.DS_Store

*.xcuserstate
src/bluecadet/core/BaseApp.h
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void BaseAppSampleApp::prepareSettings(ci::app::App::Settings* settings) {
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("appSettings.json"), [](SettingsManager * manager) {
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);
Expand All @@ -115,7 +115,7 @@ void BaseAppSampleApp::setup() {
getRootView()->setBackgroundColor(Color::gray(0.5f));

// Sample content
auto button = TouchViewRef(new TouchView());
auto button = make_shared<TouchView>();
button->setPosition(vec2(400, 300));
button->setSize(vec2(200, 100));
button->setBackgroundColor(Color(1, 0, 0));
Expand Down Expand Up @@ -205,7 +205,7 @@ void PathView::draw() {
## Notes
Version 1.5.0
Version 1.6.0
Built for [Cinder v0.9.2 dev](https://github.com/cinder/Cinder/) and [Cinder v0.9.1](https://github.com/cinder/Cinder/tree/v0.9.1). Samples require VS 2015 v140 toolset, but tested with VS 2013 v120 as well.
Expand Down
73 changes: 38 additions & 35 deletions assets/settings.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
{
"settings": {
"general": {
"consoleWindowEnabled": true,
"FPS": 60,
"appVersion": "alpha-1.0"
},
"display": {
"width": 1920,
"height": 1080,
"columns": 1,
"rows": 1
},
"graphics": {
"verticalSync": true,
"fullscreen": true,
"borderless": false
},
"debug": {
"debugMode": true,
"drawMinimap": true,
"drawTouches": false,
"minimizeParams": true,
"drawScreenLayout": false
},
"touch": {
"mouse": true,
"tuio": true,
"native": true
},
"analytics": {
"appName": "",
"trackingId": "",
"clientId": ""
}
}
"settings": {
"general": {
"console": true,
"version": "v1.0.0"
},
"display": {
"size": {"x": 1920, "y": 1080},
"columns": 1,
"rows": 1,
"bezel": {"x": 0, "y": 0}
},
"window": {
"fps": 60,
"vsync": true,
"fullscreen": true,
"borderless": false,
"size": {"x": 1280, "y": 720},
"cameraOffset": {"x": 0, "y": 0},
"clearColor": {"r": 0, "g": 0, "b": 0, "a": 1.0}
},
"touch": {
"mouse": true,
"tuio": true,
"native": false
},
"debug": {
"debugEnabled": true,
"showStats": false,
"showMinimap": false,
"showTouches": false,
"showScreenLayout": false,
"showCursor": true,
"minimizeParams": false,
"collapseParams": true,
"displayIdHotkeys": false,
"zoomToggleHotkey": true
}
}
}
2 changes: 1 addition & 1 deletion cinderblock.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
author="Bluecadet"
summary="Scene graph with nested transforms, events, touch/mouse delegation and app boilerplates."
license="MIT"
version="1.5.0"
version="1.6.0"
url="https://github.com/bluecadet/Cinder-BluecadetViews"
>

Expand Down
6 changes: 3 additions & 3 deletions samples/TextViewSample/assets/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"appVersion": "alpha-1.0"
},
"display": {
"width": 1920,
"height": 1080,
"size": {"x": 1920, "y": 1080},
"columns": 1,
"rows": 1
"rows": 1,
"bezel": {"x": 0, "y": 0}
},
"graphics": {
"verticalSync": true,
Expand Down
73 changes: 38 additions & 35 deletions samples/ViewTypesSample/assets/settings.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
{
"settings": {
"general": {
"consoleWindowEnabled": true,
"FPS": 60,
"appVersion": "alpha-1.0"
},
"display": {
"width": 1920,
"height": 1080,
"columns": 1,
"rows": 1
},
"graphics": {
"verticalSync": true,
"fullscreen": true,
"borderless": false
},
"debug": {
"debugMode": true,
"drawMinimap": true,
"drawTouches": false,
"minimizeParams": true,
"drawScreenLayout": false
},
"touch": {
"mouse": true,
"tuio": true,
"native": true
},
"analytics": {
"appName": "",
"trackingId": "",
"clientId": ""
}
}
"settings": {
"general": {
"console": true,
"version": "v1.0.0"
},
"display": {
"size": {"x": 1920, "y": 1080},
"columns": 1,
"rows": 1,
"bezel": {"x": 0, "y": 0}
},
"window": {
"fps": 60,
"vsync": true,
"fullscreen": true,
"borderless": false,
"size": {"x": 1280, "y": 720},
"cameraOffset": {"x": 0, "y": 0},
"clearColor": {"r": 0, "g": 0, "b": 0, "a": 1.0}
},
"touch": {
"mouse": true,
"tuio": true,
"native": false
},
"debug": {
"debugEnabled": true,
"showStats": false,
"showMinimap": false,
"showTouches": false,
"showScreenLayout": false,
"showCursor": true,
"minimizeParams": false,
"collapseParams": true,
"displayIdHotkeys": false,
"zoomToggleHotkey": true
}
}
}
15 changes: 8 additions & 7 deletions samples/ViewTypesSample/src/ViewTypesSampleApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,23 @@ class ViewTypesSampleApp : public BaseApp {
};

void ViewTypesSampleApp::prepareSettings(ci::app::App::Settings* settings) {
SettingsManager::getInstance()->setup(settings, "", [](SettingsManager * manager) {
SettingsManager::getInstance()->setup(settings, ci::app::getAssetPath("../assets/settings.json"), [](SettingsManager * manager) {
manager->mFullscreen = false;
manager->mWindowSize = ivec2(1280, 720);
manager->mConsoleWindowEnabled = false;
manager->mDrawMinimap = true;
manager->mDrawStats = true;
manager->mDrawTouches = true;
manager->mDisplaySize = ivec2(1280, 720);
manager->mConsole = false;
manager->mShowMinimap = true;
manager->mShowStats = true;
manager->mShowTouches = true;
manager->mMinimizeParams = true;
});
}

void ViewTypesSampleApp::setup() {
BaseApp::setup();

getRootView()->setBackgroundColor(Color::gray(0.5f));

//==================================================
// Most basic view
//
Expand Down Expand Up @@ -175,8 +178,6 @@ void ViewTypesSampleApp::setup() {
addViewSample(dragView, "TouchView with y drag");
}

getRootView()->setBackgroundColor(Color::gray(0.5f));

//==================================================
// FBO
//
Expand Down
47 changes: 28 additions & 19 deletions src/bluecadet/core/BaseApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,12 @@ BaseApp::~BaseApp() {

void BaseApp::setup() {
auto settings = SettingsManager::getInstance();

// Set up screen layout
int displayWidth = settings->hasField("settings.display.width") ? settings->getField<int>("settings.display.width") : getWindowWidth();
int displayHeight = settings->hasField("settings.display.height") ? settings->getField<int>("settings.display.height") : getWindowHeight();
int rows = settings->hasField("settings.display.rows") ? settings->getField<int>("settings.display.rows") : ScreenLayout::getInstance()->getNumRows();
int cols = settings->hasField("settings.display.columns") ? settings->getField<int>("settings.display.columns") : ScreenLayout::getInstance()->getNumColumns();

if (settings->mDisplaySize.x <= 0) settings->mDisplaySize.x = getWindowWidth();
if (settings->mDisplaySize.y <= 0) settings->mDisplaySize.y = getWindowHeight();

ScreenLayout::getInstance()->getAppSizeChangedSignal().connect(bind(&BaseApp::handleAppSizeChange, this, placeholders::_1));
ScreenLayout::getInstance()->setup(ivec2(displayWidth, displayHeight), rows, cols);
ScreenLayout::getInstance()->setup(settings->mDisplaySize, settings->mDisplayRows, settings->mDisplayColumns, settings->mBezelDims);

ScreenCamera::getInstance()->setup(ScreenLayout::getInstance());
ScreenCamera::getInstance()->getViewportChangedSignal().connect(bind(&BaseApp::handleViewportChange, this, placeholders::_1));
Expand All @@ -53,7 +50,7 @@ void BaseApp::setup() {
}

// Apply run-time settings
if (settings->mShowMouse) {
if (settings->mShowCursor) {
showCursor();
} else {
hideCursor();
Expand Down Expand Up @@ -123,25 +120,27 @@ void BaseApp::draw(const bool clear) {
mRootView->drawScene();

// draw debug touches in app coordinate space
if (settings->mDebugMode && settings->mDrawTouches) {
if (settings->mDebugEnabled && settings->mShowTouches) {
touch::TouchManager::getInstance()->debugDrawTouches();
}
}

if (settings->mDebugMode) {
if (settings->mDebugEnabled) {
// draw params and debug layers in window coordinate space
if (settings->mDrawScreenLayout) {
if (settings->mShowScreenLayout) {
gl::ScopedModelMatrix scopedMatrix;
gl::multModelMatrix(ScreenCamera::getInstance()->getTransform());
ScreenLayout::getInstance()->draw();
}
if (settings->mDrawMinimap) {
if (settings->mShowMinimap) {
mMiniMap->drawScene();
}
if (settings->mDrawStats) {
if (settings->mShowStats) {
mStats->drawScene();
}
settings->getParams()->draw();
if (settings->getParams()->isVisible()) {
settings->getParams()->draw();
}
}
}

Expand All @@ -155,6 +154,10 @@ void BaseApp::keyDown(KeyEvent event) {
case KeyEvent::KEY_q:
quit();
break;
case KeyEvent::KEY_c:
SettingsManager::getInstance()->mShowCursor = !SettingsManager::getInstance()->mShowCursor;
SettingsManager::getInstance()->mShowCursor ? showCursor() : hideCursor();
break;
case KeyEvent::KEY_f:
SettingsManager::getInstance()->mFullscreen = !isFullScreen();
setFullScreen(SettingsManager::getInstance()->mFullscreen);
Expand All @@ -166,9 +169,14 @@ void BaseApp::keyDown(KeyEvent event) {
SettingsManager::getInstance()->getParams()->maximize();

} else if (SettingsManager::getInstance()->getParams()->isMaximized()) {
SettingsManager::getInstance()->getParams()->minimize();
if (event.isShiftDown()) {
SettingsManager::getInstance()->getParams()->hide();
} else {
SettingsManager::getInstance()->getParams()->minimize();
}

} else {
SettingsManager::getInstance()->getParams()->show();
SettingsManager::getInstance()->getParams()->maximize();
}
break;
Expand All @@ -180,7 +188,8 @@ void BaseApp::handleAppSizeChange(const ci::ivec2 & appSize) {
mMiniMap->setLayout(
ScreenLayout::getInstance()->getNumColumns(),
ScreenLayout::getInstance()->getNumRows(),
ScreenLayout::getInstance()->getDisplaySize()
ScreenLayout::getInstance()->getDisplaySize(),
ScreenLayout::getInstance()->getBezelDims()
);
}

Expand All @@ -200,15 +209,15 @@ void BaseApp::addTouchSimulatorParams(float touchesPerSecond) {

params->addParam<bool>("Enabled", [&](bool v) {
if (!mSimulatedTouchDriver.isRunning()) {
SettingsManager::getInstance()->mDrawTouches = true;
SettingsManager::getInstance()->mShowTouches = true;
mSimulatedTouchDriver.setBounds(Rectf(vec2(0), getWindowSize()));
mSimulatedTouchDriver.start();
} else {
SettingsManager::getInstance()->mDrawTouches = false;
SettingsManager::getInstance()->mShowTouches = false;
mSimulatedTouchDriver.stop();
}
}, [&] {
return SettingsManager::getInstance()->mDrawTouches && mSimulatedTouchDriver.isRunning();
return SettingsManager::getInstance()->mShowTouches && mSimulatedTouchDriver.isRunning();
}).group(groupName);

static int stressTestMode = 0;
Expand Down
Loading

0 comments on commit 26018ba

Please sign in to comment.