From aef28a75fb68adca777200991fd76d950b8c6c89 Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Sun, 23 Jul 2017 13:38:09 -0400 Subject: [PATCH 01/25] Added animations sample --- .../AnimationsSample/assets/appSettings.json | 37 +++ samples/AnimationsSample/include/Resources.h | 7 + .../resources/cinder_app_icon.ico | Bin 0 -> 44737 bytes .../src/AnimationsSampleApp.cpp | 34 +++ .../vc2013/AnimationsSample.sln | 26 ++ .../vc2013/AnimationsSample.vcxproj | 268 +++++++++++++++++ .../vc2013/AnimationsSample.vcxproj.filters | 277 ++++++++++++++++++ samples/AnimationsSample/vc2013/Resources.rc | 3 + 8 files changed, 652 insertions(+) create mode 100644 samples/AnimationsSample/assets/appSettings.json create mode 100644 samples/AnimationsSample/include/Resources.h create mode 100644 samples/AnimationsSample/resources/cinder_app_icon.ico create mode 100644 samples/AnimationsSample/src/AnimationsSampleApp.cpp create mode 100644 samples/AnimationsSample/vc2013/AnimationsSample.sln create mode 100644 samples/AnimationsSample/vc2013/AnimationsSample.vcxproj create mode 100644 samples/AnimationsSample/vc2013/AnimationsSample.vcxproj.filters create mode 100644 samples/AnimationsSample/vc2013/Resources.rc diff --git a/samples/AnimationsSample/assets/appSettings.json b/samples/AnimationsSample/assets/appSettings.json new file mode 100644 index 0000000..8894739 --- /dev/null +++ b/samples/AnimationsSample/assets/appSettings.json @@ -0,0 +1,37 @@ +{ + "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": "" + } + } +} diff --git a/samples/AnimationsSample/include/Resources.h b/samples/AnimationsSample/include/Resources.h new file mode 100644 index 0000000..d0e5c9f --- /dev/null +++ b/samples/AnimationsSample/include/Resources.h @@ -0,0 +1,7 @@ +#pragma once +#include "cinder/CinderResources.h" + +//#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) + + + diff --git a/samples/AnimationsSample/resources/cinder_app_icon.ico b/samples/AnimationsSample/resources/cinder_app_icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..b35fb854d8023fb19903bba6708abe35347776c8 GIT binary patch literal 44737 zcmeFZ2UJwQ_Ar`ZfT8y$sPvB1p-CS^ETDh|kUBK!4gwB+h7JOPq7s#-w_wLS|lVrE#Bsn|D&H(@rfCk9QGQpS}I8y>p z007|Q`Jiv+eidLR-4@n^J? z{`-vxi4a31{*2%qCgDW{&CSh_u)XsG+uNiRykH=qNVoq4_3}Y6(iLL zR^1!c7?uf3^^1m4Of-znHgo$MzZy%^%Us)fo|5rTGTVEN4L!oiry55Ap5b*lwopSZj zIG?{LT1KJ0bz!->IB$Kl@}K{!J$y( zF!iURWfB4<1o231SsfwpyGA%2Az57=e%S9&pAsj>?;3eyu~^*s(~uuZ=-A>o;e*1$ zmq}WMg&{u)C^B<8n8M*qOiXYnauyQ~4kj$6 zGOWq=3JPJ%fyA)E=ThQ8p%Abza#>?EVHv6s!umlcP9T}*DO%{hn!hXk? zXruWtCPuiKSO@q}CKS}N3T#k0B?a)( zMUeUnke(HV#OPWmVAzD1aIggUya-zpEUEfJOeZSpDELft0h)hDkBJT?3k8`j!VamX z3{05N!boinsE36@NEY@Zn-CjXO%YaroP!(+5UH>jCS6J<6qyN&jy8q~Ym4T`LIEQ9 z`9hH13iw9+2EYGgWk@y%0sze<4kWZ$q!`-V|Hl7&+MyY$CAIVKb|=jWWKR;;4q22Yvp`!i#Q{iN>On^of z59blmxQbqhj`kx!re#vzTNxVYWdea@eo6e^(9FZx=NCUT=PJ=88xHlwKsppRHTC^n zDzrDgB$Jg0VPzTTBa6~MkN?>w&?u4YwKB^4x6y=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b3T!iS0H(WymeM*QF@FA-_6F~h>-OE66^w3AzU^B|Z{Ylho3=}{oLZsF7h_niW2(ODF z!cM1%G(!#d00xW$X(DZ~>HD+(zfiVE2Sdi~iXz;3-^hrZZ)9}jX<838&^ln7!&-w0 z^E@WX!a&Qh=R+M5-=0V^CMJQ_tzx^dr~fRDG?{R1*sx(XterZ3miK3A$OFR9^7NI4 zG~qot8`r?l2S%_?+YR4?{Eqy8o9D^5H#rH!Qcbut>%4aM1pJrCl5`vp7btmEhYNdhLH3zSlte{B)Q< z;Q9{p;#wQ+yJ4P@x@_69RM0Kb>p$!Deq`yoFx1zPOju9hx(mx(ym*m-Jv_bc#q~DW z7Ss0PF#k@4d44KDXiA{FQI2w)%dr;R$=ruPGpFh2pE9GxHL_^F5kctAT`dhLhb4D@%ww@LJRo|PYI zgZ*nN&UIK24m|XC;ddsid>CT=VQrE6qa6?G6n?yrFIX3UXMY20)Kpk6r1schq27W9 zT(5lm_>ulLry17fc;ULAmCg#WEG-A{&g-#%=?&42Y2kw9utwa4-y#s47yXzA%Od|c z=jjXNWmdp_2C;!PRbS~#pe(F|QhWBvaWA|V6clxd7$cd;DJ<^2$DWRHEDLM()V|(r z^6>tV(zGVxMmve@4E;Xee^?fA^feC2s%Q}L`RmDalZ`}PL9x$q49i-;v(#64yeBc+ nko + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {F74AEFC9-E3D2-43FA-B133-4503AE34DBBE} + AnimationsSample + Win32Proj + + + + Application + false + v120 + Unicode + false + + + Application + false + v120 + Unicode + false + + + Application + true + v120 + Unicode + + + Application + true + v120 + Unicode + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(ProjectDir)build\$(Platform)\$(Configuration)\ + $(ProjectDir)build\$(Platform)\$(Configuration)\intermediate\ + true + true + $(ProjectDir)build\$(Platform)\$(Configuration)\ + $(ProjectDir)build\$(Platform)\$(Configuration)\intermediate\ + false + false + + + $(ProjectDir)build\$(Platform)\$(Configuration)\ + $(ProjectDir)build\$(Platform)\$(Configuration)\intermediate\ + + + $(ProjectDir)build\$(Platform)\$(Configuration)\ + $(ProjectDir)build\$(Platform)\$(Configuration)\intermediate\ + + + + Disabled + ..\include;"..\..\..\..\..\include";..\..\..\..\Cinder-BluecadetText\src;..\..\..\src;..\..\..\..\OSC\src;..\..\..\..\TUIO\src + WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;_DEBUG;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + Level3 + EditAndContinue + true + + + "..\..\..\..\..\include";..\include + + + cinder.lib;OpenGL32.lib;%(AdditionalDependencies) + "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)\" + true + Windows + false + + MachineX86 + LIBCMT;LIBCPMT + + + + + Disabled + ..\include;"..\..\..\..\..\include";..\..\..\..\Cinder-BluecadetText\src;..\..\..\src;..\..\..\..\OSC\src;..\..\..\..\TUIO\src + WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;_DEBUG;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + Level3 + ProgramDatabase + true + + + "..\..\..\..\..\include";..\include + + + cinder.lib;OpenGL32.lib;%(AdditionalDependencies) + "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)\" + true + Windows + false + + LIBCMT;LIBCPMT + + + + + ..\include;"..\..\..\..\..\include";..\..\..\..\Cinder-BluecadetText\src;..\..\..\src;..\..\..\..\OSC\src;..\..\..\..\TUIO\src + WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;NDEBUG;%(PreprocessorDefinitions) + MultiThreaded + + Level3 + ProgramDatabase + true + + + true + + + "..\..\..\..\..\include";..\include + + + cinder.lib;OpenGL32.lib;%(AdditionalDependencies) + "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)\" + false + true + Windows + true + + false + + MachineX86 + + + + + ..\include;"..\..\..\..\..\include";..\..\..\..\Cinder-BluecadetText\src;..\..\..\src;..\..\..\..\OSC\src;..\..\..\..\TUIO\src + WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;NDEBUG;%(PreprocessorDefinitions) + MultiThreaded + + Level3 + ProgramDatabase + true + + + true + + + "..\..\..\..\..\include";..\include + + + cinder.lib;OpenGL32.lib;%(AdditionalDependencies) + "..\..\..\..\..\lib\msw\$(PlatformTarget)\";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)\" + false + true + Windows + true + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj.filters b/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj.filters new file mode 100644 index 0000000..b0c18af --- /dev/null +++ b/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj.filters @@ -0,0 +1,277 @@ + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {7698A5C6-E483-4EBE-9FCC-DA19E51FF0EA} + + + {60A5C2A6-575F-46CF-A864-20E40C24FC7E} + + + {0F11054A-54BF-4777-94AC-6845CC2B7E75} + + + {EAE90F96-EBB8-4D08-A93A-D99B83B095B2} + + + {B2B8C53C-E7E9-4460-BA3D-99B53367F847} + + + {2201C8BE-7A57-413E-9E4F-1ACDECDD1E43} + + + {036CF81F-83CE-411E-9FDC-360705F33051} + + + {02E01F77-24C0-441E-B278-F70F233AA512} + + + {4DB4F2A1-E1DB-4544-BD3F-A93E7468097C} + + + {E0E608B6-A98A-49A6-86C8-BD2480930F5C} + + + {C314367C-DEEA-441D-BC4C-D0E580C5EEB1} + + + {2FF21598-3CC7-41B2-B3CB-F43270CAA7DB} + + + {88327888-C955-4574-87E9-58EF225FCBC4} + + + {4A28F522-D047-4207-91E5-5A4639959131} + + + {DB10A8CF-0CE2-4D8F-9495-571A000312ED} + + + {979FD2B9-C2E3-4264-8220-5CC5A512B6A4} + + + {74ABC205-9439-4C12-81A8-09E1B3A9AEAE} + + + {5ED835CF-D497-4BED-8FFB-1682DC0A9EEA} + + + {EA375F23-C459-4B3C-8329-1C2D5299259F} + + + {780B6CDD-3CBF-4A86-9D8E-A0A8FF2FEF07} + + + + + Source Files + + + Source Files + + + Header Files + + + Blocks\BluecadetText\src\bluecadet\text + + + Blocks\BluecadetText\src\bluecadet\text + + + Blocks\BluecadetText\src\bluecadet\text + + + Blocks\BluecadetText\src\bluecadet\text + + + Blocks\BluecadetText\src\bluecadet\text + + + Blocks\BluecadetText\src\bluecadet\text + + + Blocks\BluecadetText\src\bluecadet\text + + + Blocks\BluecadetText\src\bluecadet\text + + + Blocks\BluecadetText\src\bluecadet\text + + + Blocks\BluecadetViews\src\bluecadet\core + + + Blocks\BluecadetViews\src\bluecadet\core + + + Blocks\BluecadetViews\src\bluecadet\core + + + Blocks\BluecadetViews\src\bluecadet\core + + + Blocks\BluecadetViews\src\bluecadet\core + + + Blocks\BluecadetViews\src\bluecadet\core + + + Blocks\BluecadetViews\src\bluecadet\core + + + Blocks\BluecadetViews\src\bluecadet\core + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\views + + + Blocks\BluecadetViews\src\bluecadet\touch + + + Blocks\BluecadetViews\src\bluecadet\touch + + + Blocks\BluecadetViews\src\bluecadet\touch + + + Blocks\BluecadetViews\src\bluecadet\touch + + + Blocks\BluecadetViews\src\bluecadet\touch + + + Blocks\BluecadetViews\src\bluecadet\touch\drivers + + + Blocks\BluecadetViews\src\bluecadet\touch\drivers + + + Blocks\BluecadetViews\src\bluecadet\touch\drivers + + + Blocks\BluecadetViews\src\bluecadet\touch\drivers + + + Blocks\BluecadetViews\src\bluecadet\touch\drivers + + + Blocks\BluecadetViews\src\bluecadet\touch\drivers + + + Blocks\BluecadetViews\src\bluecadet\touch\drivers + + + Blocks\BluecadetViews\src\bluecadet\touch\drivers + + + Blocks\OSC\src\cinder\osc + + + Blocks\OSC\src\cinder\osc + + + Blocks\TUIO\src\cinder\tuio + + + Blocks\TUIO\src\cinder\tuio + + + + + Header Files + + + + + Resource Files + + + diff --git a/samples/AnimationsSample/vc2013/Resources.rc b/samples/AnimationsSample/vc2013/Resources.rc new file mode 100644 index 0000000..282469b --- /dev/null +++ b/samples/AnimationsSample/vc2013/Resources.rc @@ -0,0 +1,3 @@ +#include "../include/Resources.h" + +1 ICON "..\\resources\\cinder_app_icon.ico" From e0fd5aa1ca1ad77a8713de734c4ce6b1143f437a Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Sun, 23 Jul 2017 13:56:36 -0400 Subject: [PATCH 02/25] Disabled forced appSettings.json loading --- .../src/AnimationsSampleApp.cpp | 47 ++++++++++++++----- src/bluecadet/core/ScreenLayout.h | 2 +- src/bluecadet/core/SettingsManager.cpp | 9 ++-- src/bluecadet/core/SettingsManager.h | 13 ++++- 4 files changed, 51 insertions(+), 20 deletions(-) diff --git a/samples/AnimationsSample/src/AnimationsSampleApp.cpp b/samples/AnimationsSample/src/AnimationsSampleApp.cpp index 832786a..3caa00c 100644 --- a/samples/AnimationsSample/src/AnimationsSampleApp.cpp +++ b/samples/AnimationsSample/src/AnimationsSampleApp.cpp @@ -2,33 +2,54 @@ #include "cinder/app/RendererGl.h" #include "cinder/gl/gl.h" +#include "bluecadet/core/BaseApp.h" +#include "bluecadet/views/TouchView.h" + using namespace ci; using namespace ci::app; using namespace std; -class AnimationsSampleApp : public App { - public: +using namespace bluecadet::core; +using namespace bluecadet::views; +using namespace bluecadet::touch; + +class AnimationsSampleApp : public BaseApp { +public: + static void prepareSettings(ci::app::App::Settings* settings); void setup() override; - void mouseDown( MouseEvent event ) override; void update() override; void draw() override; + BaseViewRef mAnimatedSizeView; }; -void AnimationsSampleApp::setup() -{ +void AnimationsSampleApp::prepareSettings(ci::app::App::Settings* settings) { + SettingsManager::getInstance()->setup(settings, [](SettingsManager * manager) { + manager->mFullscreen = false; + manager->mWindowSize = ivec2(960, 540); + manager->mConsoleWindowEnabled = false; + }); } -void AnimationsSampleApp::mouseDown( MouseEvent event ) -{ +void AnimationsSampleApp::setup() { + BaseApp::setup(); + + auto button = TouchViewRef(new 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 AnimationsSampleApp::update() -{ +void AnimationsSampleApp::update() { + // Optional override. BaseApp::update() will update all views. + BaseApp::update(); } -void AnimationsSampleApp::draw() -{ - gl::clear( Color( 0, 0, 0 ) ); +void AnimationsSampleApp::draw() { + // Optional override. BaseApp::draw() will draw all views. + BaseApp::draw(); } -CINDER_APP( AnimationsSampleApp, RendererGl ) +// Make sure to pass a reference to prepareSettings to configure the app correctly. MSAA and other render options are optional. +CINDER_APP(AnimationsSampleApp, RendererGl(RendererGl::Options().msaa(4)), AnimationsSampleApp::prepareSettings); \ No newline at end of file diff --git a/src/bluecadet/core/ScreenLayout.h b/src/bluecadet/core/ScreenLayout.h index 737550d..708f894 100644 --- a/src/bluecadet/core/ScreenLayout.h +++ b/src/bluecadet/core/ScreenLayout.h @@ -32,7 +32,7 @@ class ScreenLayout { //! Must be called before calling draw. Adds a key-up event listener. - void setup(const ci::ivec2& dislaySize = ci::ivec2(1920, 1080), const int numRows = 1, const int numColumns = 1); + void setup(const ci::ivec2& dislaySize = ci::app::getWindowSize(), const int numRows = 1, const int numColumns = 1); //! Draws the current screen layout, transformed appropriately to match the position and scale of rootView void draw(); diff --git a/src/bluecadet/core/SettingsManager.cpp b/src/bluecadet/core/SettingsManager.cpp index 5522f5a..0fee8a5 100644 --- a/src/bluecadet/core/SettingsManager.cpp +++ b/src/bluecadet/core/SettingsManager.cpp @@ -45,12 +45,7 @@ SettingsManager::SettingsManager() { } SettingsManager::~SettingsManager() {} -// Pull in the shared/standard app settings JSON void SettingsManager::setup(ci::app::App::Settings * appSettings, ci::fs::path jsonPath, std::function overrideCallback) { - // Set default path - if (jsonPath.empty()) { - jsonPath = ci::app::getAssetPath("appSettings.json"); - } // If the path exists, load it if (fs::exists(jsonPath)) { @@ -67,6 +62,10 @@ void SettingsManager::setup(ci::app::App::Settings * appSettings, ci::fs::path j CI_LOG_E("Settings file does not exist at '" << jsonPath << "'"); } + setup(appSettings, overrideCallback); +} + +void SettingsManager::setup(ci::app::App::Settings * appSettings, std::function overrideCallback) { if (overrideCallback) { overrideCallback(this); } diff --git a/src/bluecadet/core/SettingsManager.h b/src/bluecadet/core/SettingsManager.h index a726ba7..0056512 100644 --- a/src/bluecadet/core/SettingsManager.h +++ b/src/bluecadet/core/SettingsManager.h @@ -41,7 +41,18 @@ class SettingsManager { //! jsonPath will default to getAssetPath("appSettings.json") if left empty. //! overrideCallback can be used to override arguments from the json file. //! - virtual void setup(ci::app::App::Settings * appSettings, ci::fs::path jsonPath = "", std::function overrideCallback = nullptr); + virtual void setup( + ci::app::App::Settings * appSettings, + ci::fs::path jsonPath = ci::app::getAssetPath("appSettings.json"), + std::function overrideCallback = nullptr + ); + + + //! Set up the settings manager without a json file + virtual void setup( + ci::app::App::Settings * appSettings, + std::function overrideCallback = nullptr + ); //! Adds a callback to parse a command line argument by key. From 1a0789acc53c94f155dfbc88728a190e3e16e774 Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Sun, 23 Jul 2017 14:09:46 -0400 Subject: [PATCH 03/25] Cleaned up default params --- samples/AnimationsSample/src/AnimationsSampleApp.cpp | 12 ++++++------ src/bluecadet/core/SettingsManager.cpp | 12 +++++++++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/samples/AnimationsSample/src/AnimationsSampleApp.cpp b/samples/AnimationsSample/src/AnimationsSampleApp.cpp index 3caa00c..da6eb02 100644 --- a/samples/AnimationsSample/src/AnimationsSampleApp.cpp +++ b/samples/AnimationsSample/src/AnimationsSampleApp.cpp @@ -1,6 +1,7 @@ #include "cinder/app/App.h" #include "cinder/app/RendererGl.h" #include "cinder/gl/gl.h" +#include "cinder/Rand.h" #include "bluecadet/core/BaseApp.h" #include "bluecadet/views/TouchView.h" @@ -33,12 +34,11 @@ void AnimationsSampleApp::prepareSettings(ci::app::App::Settings* settings) { void AnimationsSampleApp::setup() { BaseApp::setup(); - auto button = TouchViewRef(new 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); + mAnimatedSizeView = make_shared(); + mAnimatedSizeView->setSize(vec2(300, 200)); + mAnimatedSizeView->setBackgroundColor(hsvToRgb(vec3(randFloat(), 0.8f, 1.0f))); + mAnimatedSizeView->setPosition((getRootView()->getSize() - mAnimatedSizeView->getSize()) * 0.5f); + getRootView()->addChild(mAnimatedSizeView); } void AnimationsSampleApp::update() { diff --git a/src/bluecadet/core/SettingsManager.cpp b/src/bluecadet/core/SettingsManager.cpp index 0fee8a5..1379a72 100644 --- a/src/bluecadet/core/SettingsManager.cpp +++ b/src/bluecadet/core/SettingsManager.cpp @@ -206,12 +206,18 @@ ci::params::InterfaceGlRef SettingsManager::getParams() { if (!params) { params = ci::params::InterfaceGl::create("Settings", ci::ivec2(250, 250)); params->addParam("Show Layout", &mDrawScreenLayout).group("App").key("l"); - params->addParam("Show Touches", &mDrawTouches).group("App").key("t"); params->addParam("Show Minimap", &mDrawMinimap).group("App").key("m"); params->addParam("Show Stats", &mDrawStats).group("App").key("s"); + + params->addParam("Show Touches", &mDrawTouches).group("App").key("t"); params->addParam("Show Cursor", &mShowMouse).updateFn([&] { mShowMouse ? ci::app::AppBase::get()->showCursor() : ci::app::AppBase::get()->hideCursor(); }).key("c").group("App"); - params->addParam("Show Bounds", &bluecadet::views::BaseView::sDebugDrawBounds).group("App").key("b"); - params->addParam("Show Invisible Bounds", &bluecadet::views::BaseView::sDebugDrawInvisibleBounds).group("App"); + + static int boundIndex = 0; + params->addParam("View Bounds", {"None", "Visible", "All"}, [&](int i) { + boundIndex = i; + bluecadet::views::BaseView::sDebugDrawBounds = boundIndex >= 1; + bluecadet::views::BaseView::sDebugDrawInvisibleBounds = boundIndex >= 2; + }, [&] { return boundIndex; }).key("b").group("App"); if (mMinimizeParams) { params->minimize(); From bff9adea4ebe9e9d27f8c9d5f59eb49eb46935a9 Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Sun, 23 Jul 2017 14:43:36 -0400 Subject: [PATCH 04/25] Renamed appSettings.json to settings.json; Added support to collapse params --- README.md | 6 ++--- assets/{appSettings.json => settings.json} | 1 + .../src/AnimationsSampleApp.cpp | 3 +++ src/bluecadet/core/BaseApp.cpp | 22 +++++++++++-------- src/bluecadet/core/BaseApp.h | 8 ++----- src/bluecadet/core/SettingsManager.cpp | 7 ++++++ src/bluecadet/core/SettingsManager.h | 10 ++++----- 7 files changed, 34 insertions(+), 23 deletions(-) rename assets/{appSettings.json => settings.json} (95%) diff --git a/README.md b/README.md index 0e64115..f90e41e 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,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); @@ -104,8 +104,8 @@ void BaseAppSampleApp::prepareSettings(ci::app::App::Settings* settings) { void BaseAppSampleApp::setup() { - BaseApp::setup(); - BaseApp::addTouchSimulatorParams(); + BaseApp::setup(); // Required + BaseApp::addTouchSimulatorParams(); // Optional // Optional: configure your root view getRootView()->setBackgroundColor(Color::gray(0.5f)); diff --git a/assets/appSettings.json b/assets/settings.json similarity index 95% rename from assets/appSettings.json rename to assets/settings.json index 8894739..01cd74f 100644 --- a/assets/appSettings.json +++ b/assets/settings.json @@ -21,6 +21,7 @@ "drawMinimap": true, "drawTouches": false, "minimizeParams": true, + "collapseParams": false, "drawScreenLayout": false }, "touch": { diff --git a/samples/AnimationsSample/src/AnimationsSampleApp.cpp b/samples/AnimationsSample/src/AnimationsSampleApp.cpp index da6eb02..061af83 100644 --- a/samples/AnimationsSample/src/AnimationsSampleApp.cpp +++ b/samples/AnimationsSample/src/AnimationsSampleApp.cpp @@ -28,12 +28,15 @@ void AnimationsSampleApp::prepareSettings(ci::app::App::Settings* settings) { manager->mFullscreen = false; manager->mWindowSize = ivec2(960, 540); manager->mConsoleWindowEnabled = false; + manager->mCollapseParams = true; }); } void AnimationsSampleApp::setup() { BaseApp::setup(); + addTouchSimulatorParams(); + mAnimatedSizeView = make_shared(); mAnimatedSizeView->setSize(vec2(300, 200)); mAnimatedSizeView->setBackgroundColor(hsvToRgb(vec3(randFloat(), 0.8f, 1.0f))); diff --git a/src/bluecadet/core/BaseApp.cpp b/src/bluecadet/core/BaseApp.cpp index 87eab45..e349ea4 100644 --- a/src/bluecadet/core/BaseApp.cpp +++ b/src/bluecadet/core/BaseApp.cpp @@ -68,21 +68,21 @@ void BaseApp::setup() { gl::enableAlphaBlending(); // Set up touches - if (SettingsManager::getInstance()->mMouseEnabled) { + if (settings->mMouseEnabled) { mMouseDriver.connect(); mMouseDriver.setVirtualMultiTouchEnabled(true); } - if (SettingsManager::getInstance()->mTuioTouchEnabled) { + if (settings->mTuioTouchEnabled) { mTuioDriver.connect(); } - if (SettingsManager::getInstance()->mNativeTouchEnabled) { + if (settings->mNativeTouchEnabled) { mNativeTouchDriver.connect(); } mSimulatedTouchDriver.setup(Rectf(vec2(0), getWindowSize()), 60); // Debugging - const float targetFps = (float)SettingsManager::getInstance()->mFps; + const float targetFps = (float)settings->mFps; mStats->setBackgroundColor(ColorA(0, 0, 0, 0.1f)); mStats->addGraph("FPS", 0, targetFps, ColorA(1.0f, 0.0f, 0.0f, 0.75f), ColorA(0.0f, 1.0f, 0.25f, 0.75f)); } @@ -188,9 +188,10 @@ void BaseApp::addTouchSimulatorParams(float touchesPerSecond) { mSimulatedTouchDriver.setTouchesPerSecond(touchesPerSecond); - const string groupName = "Touch-Sim"; + const string groupName = "Touch Sim"; + auto params = SettingsManager::getInstance()->getParams(); - SettingsManager::getInstance()->getParams()->addParam("Enabled", [&](bool v) { + params->addParam("Enabled", [&](bool v) { if (!mSimulatedTouchDriver.isRunning()) { SettingsManager::getInstance()->mDrawTouches = true; mSimulatedTouchDriver.setBounds(Rectf(vec2(0), getWindowSize())); @@ -206,7 +207,7 @@ void BaseApp::addTouchSimulatorParams(float touchesPerSecond) { static int stressTestMode = 0; static vector stressTestModes = {"Tap & Drag", "Slow Drag", "Tap"}; - SettingsManager::getInstance()->getParams()->addParam("Mode", stressTestModes, &stressTestMode).updateFn([&] { + params->addParam("Mode", stressTestModes, &stressTestMode).updateFn([&] { if (stressTestMode == 0) { mSimulatedTouchDriver.setMinTouchDuration(0); mSimulatedTouchDriver.setMaxTouchDuration(1.f); @@ -222,18 +223,21 @@ void BaseApp::addTouchSimulatorParams(float touchesPerSecond) { } }).group(groupName); - SettingsManager::getInstance()->getParams()->addParam("Touches/s", [&](float v) { + params->addParam("Touches/s", [&](float v) { mSimulatedTouchDriver.setTouchesPerSecond(v); }, [&]() { return mSimulatedTouchDriver.getTouchesPerSecond(); }).group(groupName); - SettingsManager::getInstance()->getParams()->addParam("Show Missed Touches", [&](bool v) { + params->addParam("Show Missed Touches", [&](bool v) { TouchManager::getInstance()->setDiscardMissedTouches(!v); }, [&]() { return !TouchManager::getInstance()->getDiscardMissedTouches(); }).group(groupName); + if (SettingsManager::getInstance()->mCollapseParams) { + params->setOptions(groupName, "opened=false"); + } } } diff --git a/src/bluecadet/core/BaseApp.h b/src/bluecadet/core/BaseApp.h index a2b0f2f..c5880a2 100644 --- a/src/bluecadet/core/BaseApp.h +++ b/src/bluecadet/core/BaseApp.h @@ -41,9 +41,6 @@ class BaseApp : public ci::app::App { virtual void handleAppSizeChange(const ci::ivec2 & appSize); virtual void handleViewportChange(const ci::Area & viewport); - //! Adds a set of params to control the touch simulator - void addTouchSimulatorParams(float touchesPerSecond = 50.f); - //! Use this view to add any children. The root view may be scaled and translated when using ScreenLayout to zoom/pan around the app. views::BaseViewRef getRootView() const { return mRootView; }; @@ -65,11 +62,10 @@ class BaseApp : public ci::app::App { //! The main mouse driver. Configured with the current window size at app launch, but needs to be started explicitly. touch::drivers::SimulatedTouchDriver & getTouchSimDriver() { return mSimulatedTouchDriver; } - //! The settings manager instance used during initialization - SettingsManagerRef getSettingsManager() const { return mSettingsManager; } + //! Adds a set of params to control the touch simulator + void addTouchSimulatorParams(float touchesPerSecond = 50.f); private: - SettingsManagerRef mSettingsManager; views::BaseViewRef mRootView; views::MiniMapViewRef mMiniMap; views::GraphViewRef mStats; diff --git a/src/bluecadet/core/SettingsManager.cpp b/src/bluecadet/core/SettingsManager.cpp index 1379a72..f8b0d7e 100644 --- a/src/bluecadet/core/SettingsManager.cpp +++ b/src/bluecadet/core/SettingsManager.cpp @@ -86,6 +86,8 @@ void SettingsManager::setup(ci::app::App::Settings * appSettings, std::function< addCommandLineParser("draw_stats", [&](const string &value) { mDrawStats = value == "true"; }); addCommandLineParser("minimizeParams", [&](const string &value) { mMinimizeParams = value == "true"; }); addCommandLineParser("minimize_params", [&](const string &value) { mMinimizeParams = value == "true"; }); + addCommandLineParser("collapseParams", [&](const string &value) { mCollapseParams = value == "true"; }); + addCommandLineParser("collapse_params", [&](const string &value) { mCollapseParams = value == "true"; }); addCommandLineParser("zoom_toggle_hotkey", [&](const string &value) { mZoomToggleHotkeyEnabled = value == "true"; }); addCommandLineParser("display_id_hotkey", [&](const string &value) { mDisplayIdHotkeysEnabled = value == "true"; }); addCommandLineParser("size", [&](const string &value) { @@ -169,6 +171,7 @@ void SettingsManager::parseJson(ci::JsonTree & json) { setFieldFromJsonIfExists(&mDrawTouches, "settings.debug.drawTouches"); setFieldFromJsonIfExists(&mDrawScreenLayout, "settings.debug.drawScreenLayout"); setFieldFromJsonIfExists(&mMinimizeParams, "settings.debug.minimizeParams"); + setFieldFromJsonIfExists(&mCollapseParams, "settings.debug.collapseParams"); setFieldFromJsonIfExists(&mZoomToggleHotkeyEnabled, "settings.debug.zoomToggleHotkey"); setFieldFromJsonIfExists(&mDisplayIdHotkeysEnabled, "settings.debug.displayIdHotkeys"); @@ -222,6 +225,10 @@ ci::params::InterfaceGlRef SettingsManager::getParams() { if (mMinimizeParams) { params->minimize(); } + + if (mCollapseParams) { + params->setOptions("App", "opened=false"); + } } return params; } diff --git a/src/bluecadet/core/SettingsManager.h b/src/bluecadet/core/SettingsManager.h index 0056512..e9ce420 100644 --- a/src/bluecadet/core/SettingsManager.h +++ b/src/bluecadet/core/SettingsManager.h @@ -38,12 +38,11 @@ class SettingsManager { //! Set up the settings manager with the path to the main json and the applications settings. Should be called in prepareSettings(). //! - //! jsonPath will default to getAssetPath("appSettings.json") if left empty. //! overrideCallback can be used to override arguments from the json file. //! virtual void setup( ci::app::App::Settings * appSettings, - ci::fs::path jsonPath = ci::app::getAssetPath("appSettings.json"), + ci::fs::path jsonPath = ci::app::getAssetPath("settings.json"), std::function overrideCallback = nullptr ); @@ -100,9 +99,10 @@ class SettingsManager { bool mShowMouse = false; bool mDrawMinimap = false; bool mDrawStats = false; - bool mMinimizeParams = false; - bool mZoomToggleHotkeyEnabled = true; - bool mDisplayIdHotkeysEnabled = false; + bool mMinimizeParams = false; //! Minimizes the params window + bool mCollapseParams = false; //! Collapses all the default parameter groups like "App" + bool mZoomToggleHotkeyEnabled = true; //! When true, will bind 0 to toggle zoom to 100%/fit + bool mDisplayIdHotkeysEnabled = false; //! When true, will bind 1-9 to zoom directly to displays 1-9 // CLI/runtime only args ci::ivec2 mWindowSize; //! The window size on launch From b8c8cfd91d030debfd5eab97f8ee05ea1b5f6a0b Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Sun, 23 Jul 2017 14:45:29 -0400 Subject: [PATCH 05/25] Minor readme tweaks --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f90e41e..0e4c207 100644 --- a/README.md +++ b/README.md @@ -104,10 +104,12 @@ void BaseAppSampleApp::prepareSettings(ci::app::App::Settings* settings) { void BaseAppSampleApp::setup() { - BaseApp::setup(); // Required - BaseApp::addTouchSimulatorParams(); // Optional + BaseApp::setup(); + + // Optional: Add touch simulator support + BaseApp::addTouchSimulatorParams(); - // Optional: configure your root view + // Optional: Configure your root view getRootView()->setBackgroundColor(Color::gray(0.5f)); // Sample content From ee293454afab898fe5e0aa11aecd611fcfc0ead8 Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Sun, 23 Jul 2017 14:46:18 -0400 Subject: [PATCH 06/25] Removed center getter/setter (too many side-effects for refactoring) --- src/bluecadet/views/BaseView.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/bluecadet/views/BaseView.h b/src/bluecadet/views/BaseView.h index 7d9098c..605216b 100644 --- a/src/bluecadet/views/BaseView.h +++ b/src/bluecadet/views/BaseView.h @@ -163,12 +163,6 @@ class BaseView : public std::enable_shared_from_this { virtual void setPosition(const ci::vec2& position) { mPosition = position; invalidate(); } virtual void setPosition(const ci::vec3& position) { mPosition = ci::vec2(position.x, position.y); invalidate(); } - //! Shorthand for combining position and size to center the view at `center` - virtual void setCenter(const ci::vec2 center) { setPosition(center - 0.5f * mSize); } - - //! Shorthand for getting the center based on the current position and size - virtual ci::vec2 getCenter() { return getPosition().value() + 0.5f * mSize; } - //! Local scale relative to parent view virtual ci::Anim& getScale() { return mScale; } virtual void setScale(const float& scale) { mScale = ci::vec2(scale, scale); invalidate(); } From 300c94d44e42ecf87a1223d79c6c47875c13577c Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Sun, 23 Jul 2017 15:37:10 -0400 Subject: [PATCH 07/25] Removed inline functions for easier maintenance --- src/bluecadet/views/BaseView.cpp | 69 ++++++++++++-- src/bluecadet/views/BaseView.h | 117 ++++++++---------------- src/bluecadet/views/CircleOutlineView.h | 12 +-- src/bluecadet/views/EllipseView.h | 4 +- src/bluecadet/views/FboView.cpp | 2 +- src/bluecadet/views/FboView.h | 2 +- src/bluecadet/views/ImageView.h | 4 +- src/bluecadet/views/TextView.cpp | 14 +-- src/bluecadet/views/TextView.h | 25 ++--- src/bluecadet/views/TouchView.h | 2 +- 10 files changed, 124 insertions(+), 127 deletions(-) diff --git a/src/bluecadet/views/BaseView.cpp b/src/bluecadet/views/BaseView.cpp index fb284db..2aae4ea 100644 --- a/src/bluecadet/views/BaseView.cpp +++ b/src/bluecadet/views/BaseView.cpp @@ -42,7 +42,7 @@ BaseView::BaseView() : mAlpha(1.0), mIsHidden(false), - mShouldForceInvisibleDraw(false), + mShouldDrawWhenInvisible(false), mBlendMode(BlendMode::INHERIT), mShouldPropagateEvents(sEventPropagationEnabled), @@ -68,7 +68,7 @@ void BaseView::reset() { mGlobalTransform = mat4(); mHasInvalidTransforms = true; mHasInvalidContent = true; - mShouldForceInvisibleDraw = false; + mShouldDrawWhenInvisible = false; mShouldPropagateEvents = true; mTint = Color(1.0f, 1.0f, 1.0f); mDrawColor = ColorA(1.0f, 1.0f, 1.0f, 1.0f); @@ -159,6 +159,18 @@ void BaseView::removeAllChildren() { } } +BaseViewList::iterator BaseView::getChildIt(BaseViewRef child) { + if (!child || child->mParent != this) return mChildren.end(); + return std::find(mChildren.begin(), mChildren.end(), child); +} + +BaseViewList::iterator BaseView::getChildIt(BaseView* childPtr) { + if (!childPtr || childPtr->mParent != this) return mChildren.end(); + return std::find_if(mChildren.begin(), mChildren.end(), [&](BaseViewRef child) { + return child.get() == childPtr; + }); +} + //================================================== // Order and Sorting // @@ -274,7 +286,7 @@ void BaseView::update(const double deltaTime) { } void BaseView::drawScene(const ColorA& parentTint) { - const bool shouldDraw = mShouldForceInvisibleDraw || (!mIsHidden && mAlpha > 0.0f); + const bool shouldDraw = mShouldDrawWhenInvisible || (!mIsHidden && mAlpha > 0.0f); if (shouldDraw || (sDebugDrawBounds && sDebugDrawInvisibleBounds)) { validateTransforms(); @@ -336,11 +348,45 @@ void BaseView::draw() { batch->draw(); } -inline void BaseView::debugDrawOutline() { - const float hue = (float)mViewId / (float)sNumInstances; - const auto color = ColorAf(ci::hsvToRgb(vec3(hue, 1.0f, 1.0f)), 0.66f); - gl::color(color); - gl::drawStrokedRect(Rectf(vec2(0), getSize())); +void BaseView::drawChildren(const ci::ColorA& parentTint) { + for (auto child : mChildren) { + child->drawScene(parentTint); + } +} + +//================================================== +// Validation +// + +void BaseView::validateTransforms(const bool force) { + if (!mHasInvalidTransforms && !force) return; + + const ci::vec3 origin = ci::vec3(mTransformOrigin.value(), 0.0f); + + mRotationScaleTransform = glm::translate(origin) // offset by origin + * glm::scale(ci::vec3(mScale.value(), 1.0f)) + * glm::toMat4(mRotation.value()) + * glm::translate(-origin); // reset to original position + + mTransform = glm::translate(ci::vec3(mPosition.value(), 0.0f)) + * mRotationScaleTransform; + + mGlobalTransform = mParent ? mParent->getGlobalTransform() * mTransform : mTransform; + + mHasInvalidTransforms = false; +} + +void BaseView::invalidate(const bool transforms, const bool content) { + if (transforms) { + mHasInvalidTransforms = true; + for (auto child : mChildren) { + child->invalidate(true, false); + } + } + + if (content) { + mHasInvalidContent = true; + } } //================================================== @@ -443,5 +489,12 @@ gl::BatchRef BaseView::getDefaultDrawBatch() { return defaultBatch; } +void BaseView::debugDrawOutline() { + const float hue = (float)mViewId / (float)sNumInstances; + const auto color = ColorAf(ci::hsvToRgb(vec3(hue, 1.0f, 1.0f)), 0.66f); + gl::color(color); + gl::drawStrokedRect(Rectf(vec2(0), getSize())); +} + } } diff --git a/src/bluecadet/views/BaseView.h b/src/bluecadet/views/BaseView.h index 605216b..a9523aa 100644 --- a/src/bluecadet/views/BaseView.h +++ b/src/bluecadet/views/BaseView.h @@ -97,7 +97,7 @@ class BaseView : public std::enable_shared_from_this { ci::TimelineRef getTimeline(); //! Returns a shared pointer to this instance - inline BaseViewRef getSharedViewPtr() { return shared_from_this(); } + BaseViewRef getSharedViewPtr() { return shared_from_this(); } //! Resets all animatable properties to their defaults and resets all animations. Does not remove children. virtual void reset(); @@ -185,16 +185,16 @@ class BaseView : public std::enable_shared_from_this { void setTransformOrigin(const ci::vec2& value, const bool compensateForOffset); //! Size of this view. Defaults to 0, 0 and is not affected by children. Does not affect transforms (position, rotation, scale). - virtual const ci::vec2 getSize() { return mSize; } - virtual void setSize(const ci::vec2& size) { mSize = size; invalidate(false, true); } + virtual ci::vec2 getSize() { return mSize; } + virtual void setSize(const ci::vec2 & size) { mSize = size; invalidate(false, true); } //! Width of this view. Defaults to 0 and is not affected by children. virtual float getWidth() { return getSize().x; } - virtual void setWidth(const float width) { ci::vec2 s = getSize(); setSize(ci::vec2(width, s.y)); } + virtual void setWidth(const float width) { setSize(ci::vec2(width, getHeight())); } //! Height of this view. Defaults to 0 and is not affected by children. virtual float getHeight() { return getSize().y; } - virtual void setHeight(const float height) { ci::vec2 s = getSize(); setSize(ci::vec2(s.x, height)); } + virtual void setHeight(const float height) { setSize(ci::vec2(getWidth(), height)); } //! The fill color used when drawing the bounding rect when a size greater than 0, 0 is given. virtual ci::Anim& getBackgroundColor() { return mBackgroundColor; } @@ -222,15 +222,15 @@ class BaseView : public std::enable_shared_from_this { virtual void setHidden(const bool isHidden) { mIsHidden = isHidden; } //! Forces redrawing even when hidden or alpha <= 0; Defaults to false - virtual bool shouldForceInvisibleDraw() const { return mShouldForceInvisibleDraw; } - virtual void setShouldForceInvisibleDraw(const bool value) { mShouldForceInvisibleDraw = value; } + virtual bool getShouldDrawWhenInvisible() const { return mShouldDrawWhenInvisible; } + virtual void setShouldDrawWhenInvisible(const bool value) { mShouldDrawWhenInvisible = value; } //! Setting this to false will prevent events from propagating from this view to its parent. Defaults to true. - bool shouldPropagateEvents() const { return mShouldPropagateEvents; } + bool setShouldPropagateEvents() const { return mShouldPropagateEvents; } void setShouldPropagateEvents(const bool value) { mShouldPropagateEvents = value; } //! Setting this to false will prevent content invalidation events from being dispatched from this view. Defaults to true. - bool shouldDispatchContentInvalidation() const { return mShouldDispatchContentInvalidation; } + bool setShouldDispatchContentInvalidation() const { return mShouldDispatchContentInvalidation; } void setShouldDispatchContentInvalidation(const bool value) { mShouldDispatchContentInvalidation = value; } //! Unique ID per view. @@ -297,38 +297,51 @@ class BaseView : public std::enable_shared_from_this { protected: - virtual void update(const double deltaTime); //! Gets called before draw() and after any parent's update. Override this method to plug into the update loop. + //! Override this method to plug into the update loop. + //! Gets called before draw() and after any parent's update. + //! Always gets called, even if view is hidden or alpha is <= 0 + virtual void update(const double deltaTime); - inline virtual void willDraw() {} //! Called by drawScene before draw() - virtual void draw(); //! Called by drawScene and allows for drawing content for this node. By default draws a rectangle with the current size and background color (only if x/y /bg-alpha > 0) - virtual void debugDrawOutline(); //! Called in DEBUG if sDebugDrawBounds is set to true. - inline virtual void drawChildren(const ci::ColorA& parentTint); //! Called by drawScene() after draw() and before didDraw(). Implemented at bottom of class. - inline virtual void didDraw() {} //! Called by drawScene after draw() + //! Override this method to plug into the draw loop. + //! Called by drawScene and allows for drawing content for this node. + //! By default draws a rectangle with the current size and background color. + //! Only gets called if visible (not hidden or alpha > 0), unless getShouldDrawWhenInvisible() is true. + virtual void draw(); - inline virtual void didMoveToView(BaseView* parent) {} //! Called when moved to a parent - inline virtual void willMoveFromView(BaseView* parent) {} //! Called when removed from a parent + virtual void willDraw() {} //! Called by drawScene before draw() + virtual void drawChildren(const ci::ColorA& parentTint); //! Called by drawScene() after draw() and before didDraw(). Implemented at bottom of class. + virtual void didDraw() {} //! Called by drawScene after draw() - const ci::ColorA& getDrawColor() const { return mDrawColor; } //! The color used for drawing, which is a composite of the alpha and tint colors. + virtual void didMoveToView(BaseView* parent) {} //! Called when moved to a parent + virtual void willMoveFromView(BaseView* parent) {} //! Called when removed from a parent + + virtual void handleSizeUpdated(const ci::vec2 & size) {}; //! Called when size is updated via an animation or setSize() + + //! The color used for drawing, which is a composite of the alpha and tint colors. + const ci::ColorA& getDrawColor() const { return mDrawColor; } //! This will recalculate the transformation matrix based on the current position, scale and rotation. Gets called automatically before getTransforms(), getGlobalTransforms() or getGlobalPosition() is called. - inline void validateTransforms(const bool force = false); + virtual void validateTransforms(const bool force = false); //! Marks the transformation matrix (and all of its children's matrices) as invalid. This will cause the matrices to be re-calculated when necessary. //! When content is true, marks the content as invalid and will dispatch a content updated event - inline void invalidate(const bool transforms = true, const bool content = true); + virtual void invalidate(const bool transforms = true, const bool content = true); //! True if any properties that visually modifies this view has been changed since the last call of validateContent(). virtual bool hasInvalidContent() const { return mHasInvalidContent; } virtual void validateContent() { mHasInvalidContent = false; } + //! Called in DEBUG if sDebugDrawBounds is set to true. + virtual void debugDrawOutline(); + private: // Helpers - inline BaseViewList::iterator getChildIt(BaseViewRef child); - inline BaseViewList::iterator getChildIt(BaseView* childPtr); + BaseViewList::iterator getChildIt(BaseViewRef child); + BaseViewList::iterator getChildIt(BaseView* childPtr); - inline static ci::gl::BatchRef getDefaultDrawBatch(); //! Default shader batch that draws the background in the default implementation of draw(). - inline static ci::gl::GlslProgRef getDefaultDrawProg(); //! Default glsl program used by the default batch that draws a rectangular background using background color and size. + static ci::gl::BatchRef getDefaultDrawBatch(); //! Default shader batch that draws the background in the default implementation of draw(). + static ci::gl::GlslProgRef getDefaultDrawProg(); //! Default glsl program used by the default batch that draws a rectangular background using background color and size. static size_t sNumInstances; @@ -343,7 +356,7 @@ class BaseView : public std::enable_shared_from_this { ci::vec2 mSize; bool mIsHidden; - bool mShouldForceInvisibleDraw; + bool mShouldDrawWhenInvisible; BlendMode mBlendMode; ci::ColorA mDrawColor; //! Combines mAlpha and mTint for faster draw @@ -376,59 +389,5 @@ class BaseView : public std::enable_shared_from_this { -//================================================== -// Inline implementations to improve speed on frequently used methods -// - -void BaseView::drawChildren(const ci::ColorA& parentTint) { - for (auto child : mChildren) { - child->drawScene(parentTint); - } -} - -void BaseView::validateTransforms(const bool force) { - if (!mHasInvalidTransforms && !force) return; - - const ci::vec3 origin = ci::vec3(mTransformOrigin.value(), 0.0f); - - mRotationScaleTransform = glm::translate(origin) // offset by origin - * glm::scale(ci::vec3(mScale.value(), 1.0f)) - * glm::toMat4(mRotation.value()) - * glm::translate(-origin); // reset to original position - - mTransform = glm::translate(ci::vec3(mPosition.value(), 0.0f)) - * mRotationScaleTransform; - - mGlobalTransform = mParent ? mParent->getGlobalTransform() * mTransform : mTransform; - - mHasInvalidTransforms = false; -} - -inline void BaseView::invalidate(const bool transforms, const bool content) { - if (transforms) { - mHasInvalidTransforms = true; - for (auto child : mChildren) { - child->invalidate(true, false); - } - } - - if (content) { - mHasInvalidContent = true; - } -} - -BaseViewList::iterator BaseView::getChildIt(BaseViewRef child) { - if (!child || child->mParent != this) return mChildren.end(); - return std::find(mChildren.begin(), mChildren.end(), child); -} - -BaseViewList::iterator BaseView::getChildIt(BaseView* childPtr) { - if (!childPtr || childPtr->mParent != this) return mChildren.end(); - return std::find_if(mChildren.begin(), mChildren.end(), [&](BaseViewRef child) { - return child.get() == childPtr; - }); -} - - } } diff --git a/src/bluecadet/views/CircleOutlineView.h b/src/bluecadet/views/CircleOutlineView.h index f0b9fa1..74c9c4c 100644 --- a/src/bluecadet/views/CircleOutlineView.h +++ b/src/bluecadet/views/CircleOutlineView.h @@ -28,15 +28,15 @@ class CircleOutlineView : public BaseView { void setRadius(const float radius); //! The smoothness of the ellipse's edge - inline float getSmoothness() const { return mSmoothness; } - inline void setSmoothness(const float value) { mSmoothness = value; invalidate(false, true); } + float getSmoothness() const { return mSmoothness; } + void setSmoothness(const float value) { mSmoothness = value; invalidate(false, true); } - inline float getBorderThickness() const { return mBorderThickness; } - inline void setBorderThickness(const float value) { mBorderThickness = value; invalidate(false, true); } + float getBorderThickness() const { return mBorderThickness; } + void setBorderThickness(const float value) { mBorderThickness = value; invalidate(false, true); } protected: - virtual void draw() override; - virtual void debugDrawOutline() override; + void draw() override; + void debugDrawOutline() override; static ci::gl::BatchRef getSharedEllipseBatch(); static ci::gl::GlslProgRef getSharedEllipseProg(); diff --git a/src/bluecadet/views/EllipseView.h b/src/bluecadet/views/EllipseView.h index 8e7afae..3288a06 100644 --- a/src/bluecadet/views/EllipseView.h +++ b/src/bluecadet/views/EllipseView.h @@ -32,8 +32,8 @@ class EllipseView : public BaseView { void setSmoothness(const float value) { mSmoothness = value; invalidate(false, true); } protected: - virtual void draw() override; - virtual void debugDrawOutline() override; + void draw() override; + void debugDrawOutline() override; static ci::gl::BatchRef getSharedEllipseBatch(); static ci::gl::GlslProgRef getSharedEllipseProg(); diff --git a/src/bluecadet/views/FboView.cpp b/src/bluecadet/views/FboView.cpp index e33978b..357a15d 100644 --- a/src/bluecadet/views/FboView.cpp +++ b/src/bluecadet/views/FboView.cpp @@ -52,7 +52,7 @@ void FboView::validateFbo(){ } } -inline void FboView::validateContent(){ +void FboView::validateContent(){ if (!mFbo) { validateFbo(); } diff --git a/src/bluecadet/views/FboView.h b/src/bluecadet/views/FboView.h index ad9ce98..07cfe15 100644 --- a/src/bluecadet/views/FboView.h +++ b/src/bluecadet/views/FboView.h @@ -64,7 +64,7 @@ class FboView : public BaseView { void validateFbo(); //! Redraw the fbo children - inline void validateContent() override; + void validateContent() override; //! Draw content within this view void draw() override; diff --git a/src/bluecadet/views/ImageView.h b/src/bluecadet/views/ImageView.h index beaceb8..0b9f130 100644 --- a/src/bluecadet/views/ImageView.h +++ b/src/bluecadet/views/ImageView.h @@ -36,7 +36,7 @@ class ImageView : public BaseView { virtual void setup(const ci::gl::TextureRef texture, const ci::vec2& size = ci::vec2(0), const ScaleMode scaleMode = ScaleMode::COVER); - virtual void setSize(const ci::vec2& size) override; + void setSize(const ci::vec2& size) override; inline ci::gl::TextureRef getTexture() const { return mTexture; } inline void setTexture(const ci::gl::TextureRef value, const bool resizeToTexture = true); @@ -46,7 +46,7 @@ class ImageView : public BaseView { private: - virtual void draw() override; + void draw() override; ci::gl::TextureRef mTexture; ci::Rectf mDrawingDestRect; diff --git a/src/bluecadet/views/TextView.cpp b/src/bluecadet/views/TextView.cpp index daedb74..faf03dd 100644 --- a/src/bluecadet/views/TextView.cpp +++ b/src/bluecadet/views/TextView.cpp @@ -115,18 +115,8 @@ void TextView::setSize(const ci::vec2& size) { setMaxSize(size); } -inline void TextView::setWidth(const float width){ - invalidate(); - setMaxWidth(width); -} - -inline void TextView::setHeight(const float height){ - invalidate(); - setMaxHeight(height); -} - -const ci::vec2 TextView::getSize() { - const vec2 maxSize = StyledTextLayout::getTextSize(); +ci::vec2 TextView::getSize() { + const vec2 maxSize = StyledTextLayout::getMaxSize(); const vec2 textSize = StyledTextLayout::getTextSize(); return vec2( max(maxSize.x, textSize.x), diff --git a/src/bluecadet/views/TextView.h b/src/bluecadet/views/TextView.h index b6e2a31..215be31 100644 --- a/src/bluecadet/views/TextView.h +++ b/src/bluecadet/views/TextView.h @@ -59,31 +59,26 @@ class TextView : public BaseView, public text::StyledTextLayout { bool getPremultiplied() const { return mPremultiplied; } void setPremultiplied(const bool value) { mPremultiplied = value; } - //! Sets a fixed size for the text view. Any values below 0 will allow the text view to automatically expand in that direction. - virtual inline void setSize(const ci::vec2& size) override; - virtual inline void setWidth(const float width) override; - virtual inline void setHeight(const float height) override; + //! Sets a fixed, max size for the text view. Any values below 0 will allow the text view to automatically expand in that direction. + void setSize(const ci::vec2& size) override; - //! Returns the actual size of the text including padding. + //! Returns the maximum size as configured via setSize(). Use getTextSize() to get the actual text size including padding. //! In advanced use-cases this can differ from what was set in setSize(), e.g. if a special clip mode is set or size-trimming is enabled. - virtual inline const ci::vec2 getSize() override; + ci::vec2 getSize() override; protected: //! Will update the text texture if necessary. - virtual void willDraw() override; - virtual void draw() override; + void willDraw() override; + void draw() override; ci::gl::Texture::Format createTextureFormat(bool smoothScaling) const; - inline void invalidate(const bool layout = true, const bool size = true) override; + void invalidate(const bool layout = true, const bool size = true) override; // Change visibility of these methods from public to protected since setSize()/getSize() should be used. - virtual ci::vec2 getMaxSize() const override { return StyledTextLayout::getMaxSize(); }; - virtual void setMaxSize(const ci::vec2& size) override { return StyledTextLayout::setMaxSize(size); }; - virtual float getMaxWidth() const override { return StyledTextLayout::getMaxWidth(); }; - virtual void setMaxWidth(const float value) override { return StyledTextLayout::setMaxWidth(value); }; - virtual float getMaxHeight() const override { return StyledTextLayout::getMaxHeight(); }; - virtual void setMaxHeight(const float value) override { return StyledTextLayout::setMaxHeight(value); }; + void setMaxSize(const ci::vec2& size) override { return StyledTextLayout::setMaxSize(size); }; + void setMaxWidth(const float value) override { return StyledTextLayout::setMaxWidth(value); }; + void setMaxHeight(const float value) override { return StyledTextLayout::setMaxHeight(value); }; bool mHasInvalidRenderedContent; bool mSmoothScalingEnabled; diff --git a/src/bluecadet/views/TouchView.h b/src/bluecadet/views/TouchView.h index 3815d81..525ae68 100644 --- a/src/bluecadet/views/TouchView.h +++ b/src/bluecadet/views/TouchView.h @@ -34,7 +34,7 @@ class TouchView : public BaseView { virtual ~TouchView(); //! Calls BaseView::reset() and cancels/ends all existing touches on this view. - virtual void reset() override; + void reset() override; //! Sets the size of this touch view and clears any existing touch path. You also just call setSize(). virtual void setup(const ci::vec2 size); From 52059314b15c3dd39507fff7b1dff3ca64df853d Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Sun, 23 Jul 2017 16:01:48 -0400 Subject: [PATCH 08/25] Added templates to assist with Anim, T operators --- .../vc2013/AnimationsSample.vcxproj | 5 +- .../vc2013/AnimationsSample.vcxproj.filters | 7 +- src/bluecadet/views/AnimationUtils.h | 132 ++++++++++++++++++ src/bluecadet/views/BaseView.cpp | 6 +- src/bluecadet/views/BaseView.h | 9 +- src/bluecadet/views/CircleOutlineView.cpp | 4 +- src/bluecadet/views/EllipseView.cpp | 4 +- src/bluecadet/views/FboView.cpp | 5 +- src/bluecadet/views/GraphView.cpp | 2 +- src/bluecadet/views/TextView.cpp | 9 -- src/bluecadet/views/TextView.h | 13 +- 11 files changed, 161 insertions(+), 35 deletions(-) create mode 100644 src/bluecadet/views/AnimationUtils.h diff --git a/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj b/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj index b8cd232..335a6d4 100644 --- a/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj +++ b/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj @@ -1,4 +1,4 @@ - + Debug @@ -230,6 +230,7 @@ + @@ -265,4 +266,4 @@ - + \ No newline at end of file diff --git a/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj.filters b/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj.filters index b0c18af..3172875 100644 --- a/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj.filters +++ b/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj.filters @@ -1,4 +1,4 @@ - + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} @@ -268,10 +268,13 @@ Header Files + + Blocks\BluecadetViews\src\bluecadet\views + Resource Files - + \ No newline at end of file diff --git a/src/bluecadet/views/AnimationUtils.h b/src/bluecadet/views/AnimationUtils.h new file mode 100644 index 0000000..8293f92 --- /dev/null +++ b/src/bluecadet/views/AnimationUtils.h @@ -0,0 +1,132 @@ +#pragma once + +#include "cinder/Tween.h" +#include "cinder/Timeline.h" + + +//================================================== +// Anim & Value +// + +template +T operator + (const ci::Anim & tween, const T & value) { + return tween.value() + value; +} + +template +T operator - (const ci::Anim & tween, const T & value) { + return tween.value() - value; +} + +template +T operator * (const ci::Anim & tween, const T & value) { + return tween.value() * value; +} + +template +T operator / (const ci::Anim & tween, const T & value) { + return tween.value() / value; +} + +template +T operator - (const ci::Anim & tween) { + return -tween.value(); +} + +//================================================== +// Value & Anim +// + +template +T operator + (const T & value, const ci::Anim & tween) { + return tween.value() + value; +} + +template +T operator - (const T & value, const ci::Anim & tween) { + return tween.value() - value; +} + +template +T operator * (const T & value, const ci::Anim & tween) { + return tween.value() * value; +} + +template +T operator / (const T & value, const ci::Anim & tween) { + return tween.value() / value; +} + + +//================================================== +// Value Conversion & Anim +// + +template +T operator + (const U & value, const ci::Anim & tween) { + return value + tween.value(); +} + +template +T operator - (const U & value, const ci::Anim & tween) { + return value - tween.value(); +} + +template +T operator * (const U & value, const ci::Anim & tween) { + return value * tween.value(); +} + +template +T operator / (const U & value, const ci::Anim & tween) { + return value / tween.value(); +} + + +//================================================== +// Anim & Value Conversion +// + +template +T operator + (const ci::Anim & tween, const U & value) { + return value + tween.value(); +} + +template +T operator - (const ci::Anim & tween, const U & value) { + return value - tween.value(); +} + +template +T operator * (const ci::Anim & tween, const U & value) { + return value * tween.value(); +} + +template +T operator / (const ci::Anim & tween, const U & value) { + return value / tween.value(); +} + +//================================================== +// Anim & Anim +// + +template +T operator + (const ci::Anim & lhs, const ci::Anim & rhs) { + return lhs.value() + rhs.value(); +} + +template +T operator - (const ci::Anim & lhs, const ci::Anim & rhs) { + return lhs.value() - rhs.value(); +} + +template +T operator * (const ci::Anim & lhs, const ci::Anim & rhs) { + return lhs.value() * rhs.value(); +} + +template +T operator / (const ci::Anim & lhs, const ci::Anim & rhs) { + return lhs.value() / rhs.value(); +} diff --git a/src/bluecadet/views/BaseView.cpp b/src/bluecadet/views/BaseView.cpp index 2aae4ea..39828a7 100644 --- a/src/bluecadet/views/BaseView.cpp +++ b/src/bluecadet/views/BaseView.cpp @@ -33,14 +33,14 @@ BaseView::BaseView() : mScale(vec2(1.0f)), mRotation(quat()), mHasInvalidTransforms(true), - mSize(0), + mSize(vec2(0)), mHasInvalidContent(true), mTint(Color::white()), mBackgroundColor(ColorA::zero()), mDrawColor(1.0f, 1.0f, 1.0f, 1.0f), - mAlpha(1.0), + mAlpha(1.0f), mIsHidden(false), mShouldDrawWhenInvisible(false), mBlendMode(BlendMode::INHERIT), @@ -333,7 +333,7 @@ void BaseView::drawScene(const ColorA& parentTint) { void BaseView::draw() { // override this method for custom drawing - const auto size = getSize(); + const auto & size = getSize().value(); const auto & color = getBackgroundColor().value(); if (size.x <= 0 && size.y <= 0 && color.a <= 0) { diff --git a/src/bluecadet/views/BaseView.h b/src/bluecadet/views/BaseView.h index a9523aa..6a57e0e 100644 --- a/src/bluecadet/views/BaseView.h +++ b/src/bluecadet/views/BaseView.h @@ -17,6 +17,7 @@ #include "boost/variant.hpp" #include "ViewEvent.h" +#include "AnimationUtils.h" namespace bluecadet { namespace views { @@ -185,15 +186,15 @@ class BaseView : public std::enable_shared_from_this { void setTransformOrigin(const ci::vec2& value, const bool compensateForOffset); //! Size of this view. Defaults to 0, 0 and is not affected by children. Does not affect transforms (position, rotation, scale). - virtual ci::vec2 getSize() { return mSize; } + virtual ci::Anim & getSize() { return mSize; } virtual void setSize(const ci::vec2 & size) { mSize = size; invalidate(false, true); } //! Width of this view. Defaults to 0 and is not affected by children. - virtual float getWidth() { return getSize().x; } + virtual float getWidth() { return getSize().value().x; } virtual void setWidth(const float width) { setSize(ci::vec2(width, getHeight())); } //! Height of this view. Defaults to 0 and is not affected by children. - virtual float getHeight() { return getSize().y; } + virtual float getHeight() { return getSize().value().y; } virtual void setHeight(const float height) { setSize(ci::vec2(getWidth(), height)); } //! The fill color used when drawing the bounding rect when a size greater than 0, 0 is given. @@ -353,7 +354,7 @@ class BaseView : public std::enable_shared_from_this { ci::Anim mAlpha; ci::Anim mTint; ci::Anim mBackgroundColor; - ci::vec2 mSize; + ci::Anim mSize; bool mIsHidden; bool mShouldDrawWhenInvisible; diff --git a/src/bluecadet/views/CircleOutlineView.cpp b/src/bluecadet/views/CircleOutlineView.cpp index 5528adb..0cc2968 100644 --- a/src/bluecadet/views/CircleOutlineView.cpp +++ b/src/bluecadet/views/CircleOutlineView.cpp @@ -35,8 +35,8 @@ void CircleOutlineView::setRadius(const float radius) { } void CircleOutlineView::draw() { - const auto& bgColor = getBackgroundColor().value(); - const auto& size = getSize(); + const auto & bgColor = getBackgroundColor().value(); + const auto & size = getSize().value(); if (size.x <= 0 && size.y <= 0 && bgColor.a <= 0) { return; diff --git a/src/bluecadet/views/EllipseView.cpp b/src/bluecadet/views/EllipseView.cpp index 22c4c0b..0a3d7e2 100644 --- a/src/bluecadet/views/EllipseView.cpp +++ b/src/bluecadet/views/EllipseView.cpp @@ -34,8 +34,8 @@ void EllipseView::setRadius(const float radius) } void EllipseView::draw() { - const auto& bgColor = getBackgroundColor().value(); - const auto& size = getSize(); + const auto & bgColor = getBackgroundColor().value(); + const auto & size = getSize().value(); if (size.x <= 0 && size.y <= 0 && bgColor.a <= 0) { return; diff --git a/src/bluecadet/views/FboView.cpp b/src/bluecadet/views/FboView.cpp index 357a15d..60efb63 100644 --- a/src/bluecadet/views/FboView.cpp +++ b/src/bluecadet/views/FboView.cpp @@ -1,4 +1,5 @@ #include "FboView.h" +#include "cinder/Log.h" using namespace ci; using namespace ci::app; @@ -83,7 +84,7 @@ void FboView::validateContent(){ BaseView::validateContent(); } else { - console() << "FboView Warning: No fbo to validate content in (size: " << getSize() << ")" << endl; + CI_LOG_W("No fbo to validate content in (size: " << getSize().value() << ")"); } } @@ -97,7 +98,7 @@ void FboView::handleEvent(ViewEvent& event) { void FboView::draw() { if (!mFbo) { - console() << "FboView Warning: No fbo to draw to (size: " << getSize() << ")" << endl; + CI_LOG_W("No fbo to validate content in (size: " << getSize().value() << ")"); return; } diff --git a/src/bluecadet/views/GraphView.cpp b/src/bluecadet/views/GraphView.cpp index 6c31f3f..bb08509 100644 --- a/src/bluecadet/views/GraphView.cpp +++ b/src/bluecadet/views/GraphView.cpp @@ -112,7 +112,7 @@ inline void GraphView::render() { gl::clear(ColorA(0, 0, 0, 0.25)); static const Font labelFont("Arial", 16); - vec2 labelPos(0, getSize().y); + vec2 labelPos(0, getSize().value().y); for (const auto & graphPair : mGraphs) { const auto & graph = graphPair.second; diff --git a/src/bluecadet/views/TextView.cpp b/src/bluecadet/views/TextView.cpp index faf03dd..b47266b 100644 --- a/src/bluecadet/views/TextView.cpp +++ b/src/bluecadet/views/TextView.cpp @@ -115,15 +115,6 @@ void TextView::setSize(const ci::vec2& size) { setMaxSize(size); } -ci::vec2 TextView::getSize() { - const vec2 maxSize = StyledTextLayout::getMaxSize(); - const vec2 textSize = StyledTextLayout::getTextSize(); - return vec2( - max(maxSize.x, textSize.x), - max(maxSize.y, textSize.y) - ); -} - ci::gl::Texture::Format TextView::createTextureFormat(bool smoothScaling) const { gl::Texture::Format format; format.immutableStorage(true); diff --git a/src/bluecadet/views/TextView.h b/src/bluecadet/views/TextView.h index 215be31..3d21e7d 100644 --- a/src/bluecadet/views/TextView.h +++ b/src/bluecadet/views/TextView.h @@ -62,23 +62,20 @@ class TextView : public BaseView, public text::StyledTextLayout { //! Sets a fixed, max size for the text view. Any values below 0 will allow the text view to automatically expand in that direction. void setSize(const ci::vec2& size) override; - //! Returns the maximum size as configured via setSize(). Use getTextSize() to get the actual text size including padding. - //! In advanced use-cases this can differ from what was set in setSize(), e.g. if a special clip mode is set or size-trimming is enabled. - ci::vec2 getSize() override; protected: //! Will update the text texture if necessary. - void willDraw() override; - void draw() override; + void willDraw() override; + void draw() override; ci::gl::Texture::Format createTextureFormat(bool smoothScaling) const; void invalidate(const bool layout = true, const bool size = true) override; // Change visibility of these methods from public to protected since setSize()/getSize() should be used. - void setMaxSize(const ci::vec2& size) override { return StyledTextLayout::setMaxSize(size); }; - void setMaxWidth(const float value) override { return StyledTextLayout::setMaxWidth(value); }; - void setMaxHeight(const float value) override { return StyledTextLayout::setMaxHeight(value); }; + void setMaxSize(const ci::vec2& size) override { return StyledTextLayout::setMaxSize(size); }; + void setMaxWidth(const float value) override { return StyledTextLayout::setMaxWidth(value); }; + void setMaxHeight(const float value) override { return StyledTextLayout::setMaxHeight(value); }; bool mHasInvalidRenderedContent; bool mSmoothScalingEnabled; From 4bd61e19cccf8b8faddca24982fd6e9aeb34de33 Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Sun, 23 Jul 2017 16:25:52 -0400 Subject: [PATCH 09/25] Added Anim conversion helpers --- src/bluecadet/views/AnimationUtils.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/bluecadet/views/AnimationUtils.h b/src/bluecadet/views/AnimationUtils.h index 8293f92..5dd9d28 100644 --- a/src/bluecadet/views/AnimationUtils.h +++ b/src/bluecadet/views/AnimationUtils.h @@ -5,7 +5,7 @@ //================================================== -// Anim & Value +// Anim + T // template @@ -34,7 +34,7 @@ T operator - (const ci::Anim & tween) { } //================================================== -// Value & Anim +// T + Anim // template @@ -59,7 +59,7 @@ T operator / (const T & value, const ci::Anim & tween) { //================================================== -// Value Conversion & Anim +// U + Anim // template @@ -84,7 +84,7 @@ T operator / (const U & value, const ci::Anim & tween) { //================================================== -// Anim & Value Conversion +// Anim + U // template @@ -107,8 +107,9 @@ T operator / (const ci::Anim & tween, const U & value) { return value / tween.value(); } + //================================================== -// Anim & Anim +// Anim + Anim // template From 0ad3333f1466866dc74790564d368727b27cd382 Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Sun, 23 Jul 2017 17:06:56 -0400 Subject: [PATCH 10/25] Implemented size animation for text view --- .../src/AnimationsSampleApp.cpp | 27 ++++++++++++++----- src/bluecadet/views/AnimationUtils.h | 25 +++++++++++++++++ src/bluecadet/views/BaseView.cpp | 14 ++++++---- src/bluecadet/views/BaseView.h | 19 ++++++++----- src/bluecadet/views/CircleOutlineView.h | 4 +-- src/bluecadet/views/EllipseView.h | 2 +- src/bluecadet/views/FboView.cpp | 4 +-- src/bluecadet/views/FboView.h | 2 +- src/bluecadet/views/ImageView.cpp | 2 +- src/bluecadet/views/LineView.h | 4 +-- src/bluecadet/views/TextView.cpp | 26 +++++++++++++++--- src/bluecadet/views/TextView.h | 5 ++++ 12 files changed, 104 insertions(+), 30 deletions(-) diff --git a/samples/AnimationsSample/src/AnimationsSampleApp.cpp b/samples/AnimationsSample/src/AnimationsSampleApp.cpp index 061af83..af0e600 100644 --- a/samples/AnimationsSample/src/AnimationsSampleApp.cpp +++ b/samples/AnimationsSample/src/AnimationsSampleApp.cpp @@ -4,6 +4,8 @@ #include "cinder/Rand.h" #include "bluecadet/core/BaseApp.h" + +#include "bluecadet/views/TextView.h" #include "bluecadet/views/TouchView.h" using namespace ci; @@ -20,7 +22,6 @@ class AnimationsSampleApp : public BaseApp { void setup() override; void update() override; void draw() override; - BaseViewRef mAnimatedSizeView; }; void AnimationsSampleApp::prepareSettings(ci::app::App::Settings* settings) { @@ -37,11 +38,25 @@ void AnimationsSampleApp::setup() { addTouchSimulatorParams(); - mAnimatedSizeView = make_shared(); - mAnimatedSizeView->setSize(vec2(300, 200)); - mAnimatedSizeView->setBackgroundColor(hsvToRgb(vec3(randFloat(), 0.8f, 1.0f))); - mAnimatedSizeView->setPosition((getRootView()->getSize() - mAnimatedSizeView->getSize()) * 0.5f); - getRootView()->addChild(mAnimatedSizeView); + //auto view = make_shared(); + auto view = make_shared(); + + view->setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. \ +Donec ornare mi ut nulla iaculis accumsan. Sed placerat vitae nisl at lobortis. \ +Proin facilisis augue nec sodales sagittis. Lorem ipsum dolor sit amet, consectetur \ +adipiscing elit. Donec ornare mi ut nulla iaculis accumsan. Sed placerat vitae nisl \ +at lobortis. Proin facilisis augue nec sodales sagittis.Lorem ipsum dolor sit amet, \ +consectetur adipiscing elit. Donec ornare mi ut nulla iaculis accumsan. Sed placerat \ +vitae nisl at lobortis. Proin facilisis augue nec sodales sagittis."); + view->setTextColor(Color::white()); + + view->setSize(vec2(300, 200)); + view->setBackgroundColor(hsvToRgb(vec3(randFloat(), 0.8f, 1.0f))); + view->setPosition((getRootView()->getSize() - view->getSize()) * 0.5f); + + view->getTimeline()->apply(&view->getSize(), vec2(200, 300), 2.0f, easeInOutQuad).loop(true).pingPong(true); + + getRootView()->addChild(view); } void AnimationsSampleApp::update() { diff --git a/src/bluecadet/views/AnimationUtils.h b/src/bluecadet/views/AnimationUtils.h index 5dd9d28..cb18339 100644 --- a/src/bluecadet/views/AnimationUtils.h +++ b/src/bluecadet/views/AnimationUtils.h @@ -131,3 +131,28 @@ template T operator / (const ci::Anim & lhs, const ci::Anim & rhs) { return lhs.value() / rhs.value(); } + + +//================================================== +// == +// + +template +bool operator == (const ci::Anim & tween, const T & value) { + return tween.value() == value; +} + +template +bool operator == (const T & value, const ci::Anim & tween) { + return value == tween.value(); +} + +template +bool operator != (const ci::Anim & tween, const T & value) { + return tween.value() != value; +} + +template +bool operator != (const T & value, const ci::Anim & tween) { + return value != tween.value(); +} diff --git a/src/bluecadet/views/BaseView.cpp b/src/bluecadet/views/BaseView.cpp index 39828a7..8437c7c 100644 --- a/src/bluecadet/views/BaseView.cpp +++ b/src/bluecadet/views/BaseView.cpp @@ -266,10 +266,14 @@ void BaseView::setTransformOrigin(const vec2 & value, const bool compensateForOf // void BaseView::updateScene(const double deltaTime) { + if (mTimeline && !mTimeline->empty()) { - mTimeline->stepTo(timeline().getCurrentTime()); invalidate(); } + + if (mTimeline) { + mTimeline->stepTo(timeline().getCurrentTime()); + } if (mHasInvalidContent && mShouldDispatchContentInvalidation) { dispatchEvent(ViewEvent(ViewEvent::Type::CONTENT_INVALIDATED, getSharedViewPtr())); @@ -376,15 +380,15 @@ void BaseView::validateTransforms(const bool force) { mHasInvalidTransforms = false; } -void BaseView::invalidate(const bool transforms, const bool content) { - if (transforms) { +void BaseView::invalidate(const int flags) { + if (flags & ValidationFlags::TRANSFORMS) { mHasInvalidTransforms = true; for (auto child : mChildren) { - child->invalidate(true, false); + child->invalidate(ValidationFlags::TRANSFORMS); } } - if (content) { + if (flags & ValidationFlags::CONTENT) { mHasInvalidContent = true; } } diff --git a/src/bluecadet/views/BaseView.h b/src/bluecadet/views/BaseView.h index 6a57e0e..0decca0 100644 --- a/src/bluecadet/views/BaseView.h +++ b/src/bluecadet/views/BaseView.h @@ -48,10 +48,15 @@ class BaseView : public std::enable_shared_from_this { > UserInfoTypes; typedef std::map UserInfo; - typedef ci::signals::Signal EventSignal; + typedef ci::signals::Signal EventSignal; typedef ci::signals::Connection EventConnection; typedef EventSignal::CallbackFn EventCallback; + enum ValidationFlags { + TRANSFORMS = (1 << 0), + CONTENT = (1 << 1) + }; + //================================================== // Construct/destruct @@ -187,7 +192,7 @@ class BaseView : public std::enable_shared_from_this { //! Size of this view. Defaults to 0, 0 and is not affected by children. Does not affect transforms (position, rotation, scale). virtual ci::Anim & getSize() { return mSize; } - virtual void setSize(const ci::vec2 & size) { mSize = size; invalidate(false, true); } + virtual void setSize(const ci::vec2 & size) { mSize = size; invalidate(ValidationFlags::CONTENT); } //! Width of this view. Defaults to 0 and is not affected by children. virtual float getWidth() { return getSize().value().x; } @@ -199,13 +204,13 @@ class BaseView : public std::enable_shared_from_this { //! The fill color used when drawing the bounding rect when a size greater than 0, 0 is given. virtual ci::Anim& getBackgroundColor() { return mBackgroundColor; } - virtual void setBackgroundColor(const ci::Color color) { mBackgroundColor = ci::ColorA(color, 1.0f); invalidate(false, true); } //! Sets background color with 100% alpha - virtual void setBackgroundColor(const ci::ColorA color) { mBackgroundColor = color; invalidate(false, true); } + virtual void setBackgroundColor(const ci::Color color) { mBackgroundColor = ci::ColorA(color, 1.0f); invalidate(ValidationFlags::CONTENT); } //! Sets background color with 100% alpha + virtual void setBackgroundColor(const ci::ColorA color) { mBackgroundColor = color; invalidate(ValidationFlags::CONTENT); } //! Applied before each draw together with mAlpha; Defaults to white virtual ci::Anim& getTint() { return mTint; } - virtual void setTint(const ci::Color tint) { mTint = tint; invalidate(false, true); } //! Sets tint while preserving current alpha - virtual void setTint(const ci::ColorA tint) { mTint = tint; mAlpha = tint.a; invalidate(false, true); } //! Sets mTint and mAlpha properties + virtual void setTint(const ci::Color tint) { mTint = tint; invalidate(ValidationFlags::CONTENT); } //! Sets tint while preserving current alpha + virtual void setTint(const ci::ColorA tint) { mTint = tint; mAlpha = tint.a; invalidate(ValidationFlags::CONTENT); } //! Sets mTint and mAlpha properties //! Applied before each draw together with mTint; Gets multiplied with parent alpha; Defaults to 1.0f virtual ci::Anim& getAlpha() { return mAlpha; } @@ -326,7 +331,7 @@ class BaseView : public std::enable_shared_from_this { //! Marks the transformation matrix (and all of its children's matrices) as invalid. This will cause the matrices to be re-calculated when necessary. //! When content is true, marks the content as invalid and will dispatch a content updated event - virtual void invalidate(const bool transforms = true, const bool content = true); + virtual void invalidate(const int flags = (ValidationFlags::TRANSFORMS | ValidationFlags::CONTENT)); //! True if any properties that visually modifies this view has been changed since the last call of validateContent(). virtual bool hasInvalidContent() const { return mHasInvalidContent; } diff --git a/src/bluecadet/views/CircleOutlineView.h b/src/bluecadet/views/CircleOutlineView.h index 74c9c4c..a09c3dd 100644 --- a/src/bluecadet/views/CircleOutlineView.h +++ b/src/bluecadet/views/CircleOutlineView.h @@ -29,10 +29,10 @@ class CircleOutlineView : public BaseView { //! The smoothness of the ellipse's edge float getSmoothness() const { return mSmoothness; } - void setSmoothness(const float value) { mSmoothness = value; invalidate(false, true); } + void setSmoothness(const float value) { mSmoothness = value; invalidate(ValidationFlags::CONTENT); } float getBorderThickness() const { return mBorderThickness; } - void setBorderThickness(const float value) { mBorderThickness = value; invalidate(false, true); } + void setBorderThickness(const float value) { mBorderThickness = value; invalidate(ValidationFlags::CONTENT); } protected: void draw() override; diff --git a/src/bluecadet/views/EllipseView.h b/src/bluecadet/views/EllipseView.h index 3288a06..3f69993 100644 --- a/src/bluecadet/views/EllipseView.h +++ b/src/bluecadet/views/EllipseView.h @@ -29,7 +29,7 @@ class EllipseView : public BaseView { //! The smoothness of the ellipse's edge ci::Anim & getSmoothness() { return mSmoothness; } - void setSmoothness(const float value) { mSmoothness = value; invalidate(false, true); } + void setSmoothness(const float value) { mSmoothness = value; invalidate(ValidationFlags::CONTENT); } protected: void draw() override; diff --git a/src/bluecadet/views/FboView.cpp b/src/bluecadet/views/FboView.cpp index 60efb63..cb7b66b 100644 --- a/src/bluecadet/views/FboView.cpp +++ b/src/bluecadet/views/FboView.cpp @@ -49,7 +49,7 @@ void FboView::validateFbo(){ if (size.x > 0 && size.y > 0) { mFbo = createFbo(size, getFboFormat()); // Invalidate content to confirm it will redraw to fbo - invalidate(false, true); + invalidate(ValidationFlags::CONTENT); } } @@ -91,7 +91,7 @@ void FboView::validateContent(){ void FboView::handleEvent(ViewEvent& event) { if (event.type == ViewEvent::Type::CONTENT_INVALIDATED) { - invalidate(false, true); + invalidate(ValidationFlags::CONTENT); } } diff --git a/src/bluecadet/views/FboView.h b/src/bluecadet/views/FboView.h index 07cfe15..bc466ca 100644 --- a/src/bluecadet/views/FboView.h +++ b/src/bluecadet/views/FboView.h @@ -24,7 +24,7 @@ class FboView : public BaseView { void setSize(const ci::vec2 & size) override; //! Will re-create the current fbo on the next draw call and marks the content to be re-drawn. - virtual void invalidateFbo() { mFbo = nullptr; invalidate(false, true); } + virtual void invalidateFbo() { mFbo = nullptr; invalidate(ValidationFlags::CONTENT); } //! Will create a new fbo with this format. virtual void setFboFormat(const ci::gl::Fbo::Format & format) { mFboFormat = format; invalidateFbo(); } diff --git a/src/bluecadet/views/ImageView.cpp b/src/bluecadet/views/ImageView.cpp index 642581a..6aefbde 100644 --- a/src/bluecadet/views/ImageView.cpp +++ b/src/bluecadet/views/ImageView.cpp @@ -54,7 +54,7 @@ void ImageView::setTexture(ci::gl::TextureRef texture, const bool resizeToTextur } } - invalidate(false, true); + invalidate(ValidationFlags::CONTENT); } void ImageView::setSize(const ci::vec2& size) { diff --git a/src/bluecadet/views/LineView.h b/src/bluecadet/views/LineView.h index 2b2c77d..104a241 100644 --- a/src/bluecadet/views/LineView.h +++ b/src/bluecadet/views/LineView.h @@ -25,11 +25,11 @@ class LineView : public BaseView { //! The thickness of the line. Defaults to 1.0f. inline ci::Anim getLineWidth() const { return mLineWidth; } - inline void setLineWidth(const float value) { mLineWidth = value; invalidate(false, true); } + inline void setLineWidth(const float value) { mLineWidth = value; invalidate(ValidationFlags::CONTENT); } //! The color of the line. Defaults to fully opaque white. inline const ci::Anim& getLineColor() const { return mLineColor; } - inline void setLineColor(const ci::ColorA& value) { mLineColor = value; invalidate(false, true); } + inline void setLineColor(const ci::ColorA& value) { mLineColor = value; invalidate(ValidationFlags::CONTENT); } protected: virtual void draw() override; diff --git a/src/bluecadet/views/TextView.cpp b/src/bluecadet/views/TextView.cpp index b47266b..9284c01 100644 --- a/src/bluecadet/views/TextView.cpp +++ b/src/bluecadet/views/TextView.cpp @@ -1,6 +1,7 @@ #include "TextView.h" #include "bluecadet/text/StyleManager.h" +#include "cinder/Log.h" #if defined(CINDER_MSW) @@ -64,6 +65,12 @@ void TextView::willDraw() { } } +void TextView::update(const double deltaTime) { + if (BaseView::getSize() != StyledTextLayout::getMaxSize()) { + StyledTextLayout::setMaxSize(BaseView::getSize()); + } +} + void TextView::draw() { BaseView::draw(); if (mTexture) { @@ -91,7 +98,12 @@ void TextView::renderContent(bool surfaceOnly, bool alpha, bool premultiplied, b mTexture = nullptr; // reset texture to save memory } else { - mTexture = gl::Texture2d::create(mSurface, createTextureFormat(mSmoothScalingEnabled)); + if (mTexture && mTexture->getSize() == mSurface.getSize()) { + mTexture->update(mSurface); + } else { + mTexture = gl::Texture2d::create(mSurface, createTextureFormat(mSmoothScalingEnabled)); + } + mSurface = ci::Surface(); // reset surface to save memory } @@ -99,10 +111,18 @@ void TextView::renderContent(bool surfaceOnly, bool alpha, bool premultiplied, b } void TextView::invalidate(const bool layout, const bool size) { + BaseView::invalidate(ValidationFlags::CONTENT); StyledTextLayout::invalidate(layout, size); mHasInvalidRenderedContent = true; +} + +void TextView::invalidate(const int flags) { + BaseView::invalidate(flags); - BaseView::invalidate(false, true); + const bool contentChanged = flags & ValidationFlags::CONTENT; + StyledTextLayout::invalidate(contentChanged, contentChanged); + + mHasInvalidRenderedContent = contentChanged; } void TextView::resetRenderedContent() { @@ -111,7 +131,7 @@ void TextView::resetRenderedContent() { } void TextView::setSize(const ci::vec2& size) { - invalidate(); + BaseView::setSize(size); setMaxSize(size); } diff --git a/src/bluecadet/views/TextView.h b/src/bluecadet/views/TextView.h index 3d21e7d..002a23a 100644 --- a/src/bluecadet/views/TextView.h +++ b/src/bluecadet/views/TextView.h @@ -67,15 +67,20 @@ class TextView : public BaseView, public text::StyledTextLayout { //! Will update the text texture if necessary. void willDraw() override; + void update(const double deltaTime) override; void draw() override; ci::gl::Texture::Format createTextureFormat(bool smoothScaling) const; void invalidate(const bool layout = true, const bool size = true) override; + void invalidate(const int flags) override; // Change visibility of these methods from public to protected since setSize()/getSize() should be used. void setMaxSize(const ci::vec2& size) override { return StyledTextLayout::setMaxSize(size); }; void setMaxWidth(const float value) override { return StyledTextLayout::setMaxWidth(value); }; void setMaxHeight(const float value) override { return StyledTextLayout::setMaxHeight(value); }; + ci::vec2 getMaxSize() const override { return StyledTextLayout::getMaxSize(); }; + float getMaxWidth() const override { return StyledTextLayout::getMaxWidth(); }; + float getMaxHeight() const override { return StyledTextLayout::getMaxHeight(); }; bool mHasInvalidRenderedContent; bool mSmoothScalingEnabled; From a53b9e1bb711bf35932b0a7c22cde9e9aa160269 Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Sun, 23 Jul 2017 17:20:58 -0400 Subject: [PATCH 11/25] Made image and text view size anim compatible --- .../AnimationsSample/assets/appSettings.json | 37 -------------- .../AnimationsSample/assets/cinderblock.png | Bin 0 -> 8773 bytes .../src/AnimationsSampleApp.cpp | 48 ++++++++++++------ src/bluecadet/views/ImageView.cpp | 9 ++-- src/bluecadet/views/ImageView.h | 4 +- src/bluecadet/views/TextView.cpp | 2 +- src/bluecadet/views/TextView.h | 2 +- 7 files changed, 38 insertions(+), 64 deletions(-) delete mode 100644 samples/AnimationsSample/assets/appSettings.json create mode 100644 samples/AnimationsSample/assets/cinderblock.png diff --git a/samples/AnimationsSample/assets/appSettings.json b/samples/AnimationsSample/assets/appSettings.json deleted file mode 100644 index 8894739..0000000 --- a/samples/AnimationsSample/assets/appSettings.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "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": "" - } - } -} diff --git a/samples/AnimationsSample/assets/cinderblock.png b/samples/AnimationsSample/assets/cinderblock.png new file mode 100644 index 0000000000000000000000000000000000000000..6f2de5cbf8358d383212db1423920d9e87cd526c GIT binary patch literal 8773 zcmbt&1yJ10vhT9k;!d(y7Izkw;O_1gTo(zNW%1wy3n3wBAOr{=+=4?O1c%@jJV0RZrz zr}zsW000;2Bqyh>A}0s&K)BmGxxfJc<(|wGAAS94%Bb(HKK?mFyklVhL>}Id6CMaH zhR#EKtcU%8ulO1+(M8hoBqV4GZ?Z$sa&weRqiyKfimZr~iM4HbV~dLH6sJ_5`}rNL zub=m{F3mX{c%IJ&WYzHin6w`8KrvH*kaw)h*#5%fMlX~`s%`;Tz9DD@0AAy*;x?K6 z4rwN+&;$RbUYwhki}+~DH*N4=TUv$T_gZ76`fUI}uVvSUi>9br*Cm5yKY3p49zR1t zH&ZNFG3FgqRl5se6K}efpA|?st24N3M`zl#`d)9g&xP+i+BYEb4Wmt$QWqxJOtT=` z{pAyWm9#;MBhzOtu&8&0fLNx_c*3Q=BpK0ZT||UPk|PAbBd-A}yn#pQQH`-G*O-@Q zf86-&2-w7<_S)^K>ri$80+uKY49$^BOzvH)+2UdED^|A<1iW;(;{rc(-TKI2nr>oh zLX{4F7o<~k-*h3wyuZiLihD87A3b#*wO4VYyA7}!jD1?OLu5J_1Q7iUg!tSOWo*y` zm=pq?+mF8aIj;J}JOJss#=YX_=YQ2elakPo-M$kndP5L+B*A#(-JTk?-yZ|VO~gPx zTX@2*!Y(T*A(7m-Izn(S-gPg0SaJM>syAl+P()luzR0n^p+#7y+0UgsB%?Fe)9=1G z=AL&~%jCUt0^4a8K%gI_ypRoC+msCXNQ_46r#*kVbiENygt?mWpg^=r_&f{q_PX37 z<|1ME)iuo~=|gn~oJ;Ua=T&E%kq`hA8b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samples/AnimationsSample/src/AnimationsSampleApp.cpp +++ b/samples/AnimationsSample/src/AnimationsSampleApp.cpp @@ -7,6 +7,7 @@ #include "bluecadet/views/TextView.h" #include "bluecadet/views/TouchView.h" +#include "bluecadet/views/ImageView.h" using namespace ci; using namespace ci::app; @@ -38,25 +39,40 @@ void AnimationsSampleApp::setup() { addTouchSimulatorParams(); - //auto view = make_shared(); - auto view = make_shared(); + BaseViewRef child = nullptr; - view->setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. \ -Donec ornare mi ut nulla iaculis accumsan. Sed placerat vitae nisl at lobortis. \ -Proin facilisis augue nec sodales sagittis. Lorem ipsum dolor sit amet, consectetur \ -adipiscing elit. Donec ornare mi ut nulla iaculis accumsan. Sed placerat vitae nisl \ -at lobortis. Proin facilisis augue nec sodales sagittis.Lorem ipsum dolor sit amet, \ -consectetur adipiscing elit. Donec ornare mi ut nulla iaculis accumsan. Sed placerat \ -vitae nisl at lobortis. Proin facilisis augue nec sodales sagittis."); - view->setTextColor(Color::white()); + if (false) { + // BaseView + auto view = make_shared(); + child = view; + } + if (true) { + auto view = make_shared(); + view->setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. \ + Donec ornare mi ut nulla iaculis accumsan. Sed placerat vitae nisl at lobortis. \ + Proin facilisis augue nec sodales sagittis. Lorem ipsum dolor sit amet, consectetur \ + adipiscing elit. Donec ornare mi ut nulla iaculis accumsan. Sed placerat vitae nisl \ + at lobortis. Proin facilisis augue nec sodales sagittis.Lorem ipsum dolor sit amet, \ + consectetur adipiscing elit. Donec ornare mi ut nulla iaculis accumsan. Sed placerat \ + vitae nisl at lobortis. Proin facilisis augue nec sodales sagittis."); + view->setTextColor(Color::white()); + child = view; + } + if (false) { + // ImageView + auto view = make_shared(); + auto image = loadImage(getAssetPath("cinderblock.png")); + auto texture = gl::Texture::create(image); + view->setTexture(texture); + child = view; + } - view->setSize(vec2(300, 200)); - view->setBackgroundColor(hsvToRgb(vec3(randFloat(), 0.8f, 1.0f))); - view->setPosition((getRootView()->getSize() - view->getSize()) * 0.5f); + child->setSize(vec2(300, 200)); + child->setBackgroundColor(hsvToRgb(vec3(randFloat(), 0.8f, 1.0f))); + child->setPosition((getRootView()->getSize() - child->getSize()) * 0.5f); + child->getTimeline()->apply(&child->getSize(), vec2(200, 300), 2.0f, easeInOutQuad).loop(true).pingPong(true); - view->getTimeline()->apply(&view->getSize(), vec2(200, 300), 2.0f, easeInOutQuad).loop(true).pingPong(true); - - getRootView()->addChild(view); + getRootView()->addChild(child); } void AnimationsSampleApp::update() { diff --git a/src/bluecadet/views/ImageView.cpp b/src/bluecadet/views/ImageView.cpp index 6aefbde..9524707 100644 --- a/src/bluecadet/views/ImageView.cpp +++ b/src/bluecadet/views/ImageView.cpp @@ -10,7 +10,7 @@ namespace views { ImageView::ImageView() : BaseView(), mTexture(nullptr), -mScaleMode(ScaleMode::NONE) +mScaleMode(ScaleMode::STRETCH) { } @@ -26,7 +26,6 @@ void ImageView::clearTexture() { mTexture = nullptr; mDrawingDestRect = Rectf(); mDrawingArea = Area(); - mScaleMode = ScaleMode::NONE; } void ImageView::setup(const gl::TextureRef texture, const ci::vec2 &size, const ScaleMode scaleMode) { @@ -57,10 +56,8 @@ void ImageView::setTexture(ci::gl::TextureRef texture, const bool resizeToTextur invalidate(ValidationFlags::CONTENT); } -void ImageView::setSize(const ci::vec2& size) { - BaseView::setSize(size); - - mDrawingDestRect = Rectf(vec2(0), size); +void ImageView::validateContent() { + mDrawingDestRect = Rectf(vec2(0), getSize().value()); if (mTexture) { // Aspect fill drawing area diff --git a/src/bluecadet/views/ImageView.h b/src/bluecadet/views/ImageView.h index 0b9f130..8ce0890 100644 --- a/src/bluecadet/views/ImageView.h +++ b/src/bluecadet/views/ImageView.h @@ -36,8 +36,6 @@ class ImageView : public BaseView { virtual void setup(const ci::gl::TextureRef texture, const ci::vec2& size = ci::vec2(0), const ScaleMode scaleMode = ScaleMode::COVER); - void setSize(const ci::vec2& size) override; - inline ci::gl::TextureRef getTexture() const { return mTexture; } inline void setTexture(const ci::gl::TextureRef value, const bool resizeToTexture = true); @@ -45,7 +43,7 @@ class ImageView : public BaseView { inline void setScaleMode(const ScaleMode scaleMode) { mScaleMode = scaleMode; } private: - + void validateContent() override; void draw() override; ci::gl::TextureRef mTexture; diff --git a/src/bluecadet/views/TextView.cpp b/src/bluecadet/views/TextView.cpp index 9284c01..1ef457d 100644 --- a/src/bluecadet/views/TextView.cpp +++ b/src/bluecadet/views/TextView.cpp @@ -65,7 +65,7 @@ void TextView::willDraw() { } } -void TextView::update(const double deltaTime) { +void TextView::validateContent() { if (BaseView::getSize() != StyledTextLayout::getMaxSize()) { StyledTextLayout::setMaxSize(BaseView::getSize()); } diff --git a/src/bluecadet/views/TextView.h b/src/bluecadet/views/TextView.h index 002a23a..c01b75e 100644 --- a/src/bluecadet/views/TextView.h +++ b/src/bluecadet/views/TextView.h @@ -67,10 +67,10 @@ class TextView : public BaseView, public text::StyledTextLayout { //! Will update the text texture if necessary. void willDraw() override; - void update(const double deltaTime) override; void draw() override; ci::gl::Texture::Format createTextureFormat(bool smoothScaling) const; + void validateContent() override; void invalidate(const bool layout = true, const bool size = true) override; void invalidate(const int flags) override; From b24d38166845f4f75c378374beadc6318a4d8e68 Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Sun, 23 Jul 2017 17:38:48 -0400 Subject: [PATCH 12/25] Implemented size anim for FboView --- .../src/AnimationsSampleApp.cpp | 64 +++++++++++++------ src/bluecadet/views/CircleOutlineView.cpp | 2 +- src/bluecadet/views/EllipseView.cpp | 2 +- src/bluecadet/views/FboView.cpp | 2 +- 4 files changed, 46 insertions(+), 24 deletions(-) diff --git a/samples/AnimationsSample/src/AnimationsSampleApp.cpp b/samples/AnimationsSample/src/AnimationsSampleApp.cpp index abf71cb..728c5a0 100644 --- a/samples/AnimationsSample/src/AnimationsSampleApp.cpp +++ b/samples/AnimationsSample/src/AnimationsSampleApp.cpp @@ -8,6 +8,7 @@ #include "bluecadet/views/TextView.h" #include "bluecadet/views/TouchView.h" #include "bluecadet/views/ImageView.h" +#include "bluecadet/views/FboView.h" using namespace ci; using namespace ci::app; @@ -30,6 +31,7 @@ void AnimationsSampleApp::prepareSettings(ci::app::App::Settings* settings) { manager->mFullscreen = false; manager->mWindowSize = ivec2(960, 540); manager->mConsoleWindowEnabled = false; + manager->mMinimizeParams = true; manager->mCollapseParams = true; }); } @@ -39,40 +41,60 @@ void AnimationsSampleApp::setup() { addTouchSimulatorParams(); - BaseViewRef child = nullptr; + vector views; - if (false) { - // BaseView - auto view = make_shared(); - child = view; - } - if (true) { - auto view = make_shared(); - view->setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. \ + { + auto textView = make_shared(); + textView->setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. \ Donec ornare mi ut nulla iaculis accumsan. Sed placerat vitae nisl at lobortis. \ Proin facilisis augue nec sodales sagittis. Lorem ipsum dolor sit amet, consectetur \ adipiscing elit. Donec ornare mi ut nulla iaculis accumsan. Sed placerat vitae nisl \ at lobortis. Proin facilisis augue nec sodales sagittis.Lorem ipsum dolor sit amet, \ consectetur adipiscing elit. Donec ornare mi ut nulla iaculis accumsan. Sed placerat \ vitae nisl at lobortis. Proin facilisis augue nec sodales sagittis."); - view->setTextColor(Color::white()); - child = view; + textView->setTextColor(Color::white()); + views.push_back(textView); + } + + { + auto imageView = make_shared(); + auto image = loadImage(getAssetPath("cinderblock.png")); + auto texture = gl::Texture::create(image); + imageView->setTexture(texture); + views.push_back(imageView); } - if (false) { - // ImageView - auto view = make_shared(); + + { + auto imageView = make_shared(); auto image = loadImage(getAssetPath("cinderblock.png")); auto texture = gl::Texture::create(image); - view->setTexture(texture); - child = view; + imageView->setTexture(texture); + + auto fboView = make_shared(); + fboView->addChild(imageView); + views.push_back(fboView); } - child->setSize(vec2(300, 200)); - child->setBackgroundColor(hsvToRgb(vec3(randFloat(), 0.8f, 1.0f))); - child->setPosition((getRootView()->getSize() - child->getSize()) * 0.5f); - child->getTimeline()->apply(&child->getSize(), vec2(200, 300), 2.0f, easeInOutQuad).loop(true).pingPong(true); + float numCols = 3; + float numRows = 3; + float widthPerView = getWindowWidth() / numCols; + float heightPerView = getWindowHeight() / numRows; + float delayPerView = 0.1f; + for (float i = 0; i < views.size(); ++i) { + auto view = views[(int)i]; + float col = glm::floor(glm::mod(i, numCols)); + float row = glm::floor(i / numRows); + - getRootView()->addChild(child); + view->setBackgroundColor(hsvToRgb(vec3(randFloat(), 0.8f, 1.0f))); + view->setPosition(vec2(col * widthPerView, row * heightPerView)); + view->setSize(vec2(widthPerView, heightPerView)); + + view->getTimeline()->apply(&view->getSize(), view->getSize() * 0.5f, 2.0f, easeInOutQuad) + .loop(true).pingPong(true).delay(i / (float)views.size()); + + getRootView()->addChild(view); + } } void AnimationsSampleApp::update() { diff --git a/src/bluecadet/views/CircleOutlineView.cpp b/src/bluecadet/views/CircleOutlineView.cpp index 0cc2968..c473ac8 100644 --- a/src/bluecadet/views/CircleOutlineView.cpp +++ b/src/bluecadet/views/CircleOutlineView.cpp @@ -44,7 +44,7 @@ void CircleOutlineView::draw() { auto batch = getSharedEllipseBatch(); auto prog = batch->getGlslProg(); - prog->uniform("uSize", getSize()); + prog->uniform("uSize", size); prog->uniform("uBackgroundColor", vec4(bgColor.r, bgColor.g, bgColor.b, bgColor.a)); prog->uniform("uSmoothness", mSmoothness); prog->uniform("uBorderThickness", mBorderThickness); diff --git a/src/bluecadet/views/EllipseView.cpp b/src/bluecadet/views/EllipseView.cpp index 0a3d7e2..6530b9c 100644 --- a/src/bluecadet/views/EllipseView.cpp +++ b/src/bluecadet/views/EllipseView.cpp @@ -43,7 +43,7 @@ void EllipseView::draw() { auto batch = getSharedEllipseBatch(); auto prog = batch->getGlslProg(); - prog->uniform("uSize", getSize()); + prog->uniform("uSize", size); prog->uniform("uBackgroundColor", vec4(bgColor.r, bgColor.g, bgColor.b, bgColor.a)); prog->uniform("uSmoothness", mSmoothness); batch->draw(); diff --git a/src/bluecadet/views/FboView.cpp b/src/bluecadet/views/FboView.cpp index cb7b66b..cefb41c 100644 --- a/src/bluecadet/views/FboView.cpp +++ b/src/bluecadet/views/FboView.cpp @@ -54,7 +54,7 @@ void FboView::validateFbo(){ } void FboView::validateContent(){ - if (!mFbo) { + if (!mFbo || mFbo->getSize() != ivec2(getSize().value())) { validateFbo(); } From 95245ae0eefcf32bc35f0c4ec24a353638fb89fe Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Sun, 23 Jul 2017 17:54:15 -0400 Subject: [PATCH 13/25] Added ellipse view --- .../AnimationsSample/src/AnimationsSampleApp.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/samples/AnimationsSample/src/AnimationsSampleApp.cpp b/samples/AnimationsSample/src/AnimationsSampleApp.cpp index 728c5a0..65343cb 100644 --- a/samples/AnimationsSample/src/AnimationsSampleApp.cpp +++ b/samples/AnimationsSample/src/AnimationsSampleApp.cpp @@ -9,6 +9,7 @@ #include "bluecadet/views/TouchView.h" #include "bluecadet/views/ImageView.h" #include "bluecadet/views/FboView.h" +#include "bluecadet/views/EllipseView.h" using namespace ci; using namespace ci::app; @@ -75,6 +76,13 @@ void AnimationsSampleApp::setup() { views.push_back(fboView); } + { + auto ellipseView = make_shared(); + ellipseView->setSmoothness(50.0f); + ellipseView->setTransformOrigin(vec2(150, 100)); + views.push_back(ellipseView); + } + float numCols = 3; float numRows = 3; float widthPerView = getWindowWidth() / numCols; @@ -85,12 +93,11 @@ void AnimationsSampleApp::setup() { float col = glm::floor(glm::mod(i, numCols)); float row = glm::floor(i / numRows); - view->setBackgroundColor(hsvToRgb(vec3(randFloat(), 0.8f, 1.0f))); - view->setPosition(vec2(col * widthPerView, row * heightPerView)); + view->setPosition(vec2(col * widthPerView, row * heightPerView) + view->getTransformOrigin()); view->setSize(vec2(widthPerView, heightPerView)); - view->getTimeline()->apply(&view->getSize(), view->getSize() * 0.5f, 2.0f, easeInOutQuad) + view->getTimeline()->apply(&view->getSize(), vec2(view->getHeight(), view->getWidth()) * 0.25f, 2.0f, easeInOutQuad) .loop(true).pingPong(true).delay(i / (float)views.size()); getRootView()->addChild(view); From 3020d3c3d912aa59ff18b74f66f6b5ebfcd9b0df Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Sun, 23 Jul 2017 18:17:32 -0400 Subject: [PATCH 14/25] Implemented >, <, >=, <= for Anim --- .../src/AnimationsSampleApp.cpp | 8 +-- src/bluecadet/views/AnimationUtils.h | 51 ++++++++++++++++++- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/samples/AnimationsSample/src/AnimationsSampleApp.cpp b/samples/AnimationsSample/src/AnimationsSampleApp.cpp index 65343cb..5e04882 100644 --- a/samples/AnimationsSample/src/AnimationsSampleApp.cpp +++ b/samples/AnimationsSample/src/AnimationsSampleApp.cpp @@ -79,12 +79,12 @@ void AnimationsSampleApp::setup() { { auto ellipseView = make_shared(); ellipseView->setSmoothness(50.0f); - ellipseView->setTransformOrigin(vec2(150, 100)); + ellipseView->setTransformOrigin(vec2(220, 110)); views.push_back(ellipseView); } - float numCols = 3; - float numRows = 3; + float numCols = 2; + float numRows = 2; float widthPerView = getWindowWidth() / numCols; float heightPerView = getWindowHeight() / numRows; float delayPerView = 0.1f; @@ -97,7 +97,7 @@ void AnimationsSampleApp::setup() { view->setPosition(vec2(col * widthPerView, row * heightPerView) + view->getTransformOrigin()); view->setSize(vec2(widthPerView, heightPerView)); - view->getTimeline()->apply(&view->getSize(), vec2(view->getHeight(), view->getWidth()) * 0.25f, 2.0f, easeInOutQuad) + view->getTimeline()->apply(&view->getSize(), view->getSize() * vec2(0.33f, 0.66f), 2.0f, easeInOutQuad) .loop(true).pingPong(true).delay(i / (float)views.size()); getRootView()->addChild(view); diff --git a/src/bluecadet/views/AnimationUtils.h b/src/bluecadet/views/AnimationUtils.h index cb18339..ce0627f 100644 --- a/src/bluecadet/views/AnimationUtils.h +++ b/src/bluecadet/views/AnimationUtils.h @@ -134,7 +134,7 @@ T operator / (const ci::Anim & lhs, const ci::Anim & rhs) { //================================================== -// == +// ==, != // template @@ -156,3 +156,52 @@ template bool operator != (const T & value, const ci::Anim & tween) { return value != tween.value(); } + + +//================================================== +// >, <, <=, >= +// + +template +bool operator > (const ci::Anim & tween, const T & value) { + return tween.value() > value; +} + +template +bool operator > (const T & value, const ci::Anim & tween) { + return value > tween.value(); +} + + +template +bool operator < (const ci::Anim & tween, const T & value) { + return tween.value() < value; +} + +template +bool operator < (const T & value, const ci::Anim & tween) { + return value < tween.value(); +} + + +template +bool operator >= (const ci::Anim & tween, const T & value) { + return tween.value() >= value; +} + +template +bool operator >= (const T & value, const ci::Anim & tween) { + return value >= tween.value(); +} + + +template +bool operator <= (const ci::Anim & tween, const T & value) { + return tween.value() <= value; +} + +template +bool operator <= (const T & value, const ci::Anim & tween) { + return value <= tween.value(); +} + From 954af026c1dcbaaf4ef6b965035782181aaf2aab Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Sun, 23 Jul 2017 18:38:04 -0400 Subject: [PATCH 15/25] Made invalidation bit checks more robus --- src/bluecadet/views/AnimationUtils.h | 2 -- src/bluecadet/views/BaseView.cpp | 4 ++-- src/bluecadet/views/TextView.cpp | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/bluecadet/views/AnimationUtils.h b/src/bluecadet/views/AnimationUtils.h index ce0627f..0db2ac2 100644 --- a/src/bluecadet/views/AnimationUtils.h +++ b/src/bluecadet/views/AnimationUtils.h @@ -1,8 +1,6 @@ #pragma once #include "cinder/Tween.h" -#include "cinder/Timeline.h" - //================================================== // Anim + T diff --git a/src/bluecadet/views/BaseView.cpp b/src/bluecadet/views/BaseView.cpp index 8437c7c..3a2f7ca 100644 --- a/src/bluecadet/views/BaseView.cpp +++ b/src/bluecadet/views/BaseView.cpp @@ -381,14 +381,14 @@ void BaseView::validateTransforms(const bool force) { } void BaseView::invalidate(const int flags) { - if (flags & ValidationFlags::TRANSFORMS) { + if ((flags & ValidationFlags::TRANSFORMS) == ValidationFlags::TRANSFORMS){ mHasInvalidTransforms = true; for (auto child : mChildren) { child->invalidate(ValidationFlags::TRANSFORMS); } } - if (flags & ValidationFlags::CONTENT) { + if ((flags & ValidationFlags::CONTENT) == ValidationFlags::CONTENT) { mHasInvalidContent = true; } } diff --git a/src/bluecadet/views/TextView.cpp b/src/bluecadet/views/TextView.cpp index 1ef457d..ef14be8 100644 --- a/src/bluecadet/views/TextView.cpp +++ b/src/bluecadet/views/TextView.cpp @@ -119,7 +119,7 @@ void TextView::invalidate(const bool layout, const bool size) { void TextView::invalidate(const int flags) { BaseView::invalidate(flags); - const bool contentChanged = flags & ValidationFlags::CONTENT; + const bool contentChanged = (flags & ValidationFlags::CONTENT) == ValidationFlags::CONTENT; StyledTextLayout::invalidate(contentChanged, contentChanged); mHasInvalidRenderedContent = contentChanged; From 18cf1c1be10bb142dbf030426e596988d78ea061 Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Mon, 24 Jul 2017 14:19:05 -0400 Subject: [PATCH 16/25] Fixed json reference in cinderblock.xml --- cinderblock.xml | 2 +- src/bluecadet/views/AnimationUtils.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cinderblock.xml b/cinderblock.xml index 6cf9884..ed05f13 100644 --- a/cinderblock.xml +++ b/cinderblock.xml @@ -14,7 +14,7 @@ org.libcinder.tuio com.bluecadet.cinder.text - assets/appSettings.json + assets/settings.json src/*.h src/*.cpp diff --git a/src/bluecadet/views/AnimationUtils.h b/src/bluecadet/views/AnimationUtils.h index 0db2ac2..97eba44 100644 --- a/src/bluecadet/views/AnimationUtils.h +++ b/src/bluecadet/views/AnimationUtils.h @@ -107,7 +107,7 @@ T operator / (const ci::Anim & tween, const U & value) { //================================================== -// Anim + Anim +// Anim + Anim // template @@ -202,4 +202,3 @@ template bool operator <= (const T & value, const ci::Anim & tween) { return value <= tween.value(); } - From afb14b2d6e6f99cfe12651ef5b4301f7267dd560 Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Mon, 24 Jul 2017 18:14:45 -0400 Subject: [PATCH 17/25] Added getRotationZ() to base view --- src/bluecadet/views/BaseView.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bluecadet/views/BaseView.h b/src/bluecadet/views/BaseView.h index 0decca0..ed282c8 100644 --- a/src/bluecadet/views/BaseView.h +++ b/src/bluecadet/views/BaseView.h @@ -175,8 +175,10 @@ class BaseView : public std::enable_shared_from_this { virtual void setScale(const ci::vec2& scale) { mScale = scale; invalidate(); } virtual void setScale(const ci::vec3& scale) { mScale = ci::vec2(scale.x, scale.y); invalidate(); } - //! Local rotation relative to parent view. Changing this value invalidates transforms. + //! Local rotation as quaternion. Changing this value invalidates transforms. virtual ci::Anim& getRotation() { return mRotation; } + //! Local rotation around Z axis in radians. + virtual float getRotationZ() const { return glm::two_pi() - glm::angle(mRotation.value()); } virtual void setRotation(const float radians) { mRotation = glm::angleAxis(radians, ci::vec3(0, 0, 1)); invalidate(); } virtual void setRotation(const ci::quat& rotation) { mRotation = rotation; invalidate(); } From 01fad96b056b9b29337a7081fd27ec3c91c8bb23 Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Tue, 25 Jul 2017 10:15:26 -0400 Subject: [PATCH 18/25] Renamed AnimationUtils.h to AnimOperators.h --- src/bluecadet/views/{AnimationUtils.h => AnimOperators.h} | 0 src/bluecadet/views/BaseView.h | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename src/bluecadet/views/{AnimationUtils.h => AnimOperators.h} (100%) diff --git a/src/bluecadet/views/AnimationUtils.h b/src/bluecadet/views/AnimOperators.h similarity index 100% rename from src/bluecadet/views/AnimationUtils.h rename to src/bluecadet/views/AnimOperators.h diff --git a/src/bluecadet/views/BaseView.h b/src/bluecadet/views/BaseView.h index ed282c8..1ebb2e0 100644 --- a/src/bluecadet/views/BaseView.h +++ b/src/bluecadet/views/BaseView.h @@ -17,7 +17,7 @@ #include "boost/variant.hpp" #include "ViewEvent.h" -#include "AnimationUtils.h" +#include "AnimOperators.h" namespace bluecadet { namespace views { From 5025b0fb9fc0fd8fb2a49996e433b70759e7a8d1 Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Tue, 25 Jul 2017 10:20:37 -0400 Subject: [PATCH 19/25] Made all AnimOperators inline --- .../vc2013/AnimationsSample.vcxproj | 2 +- .../vc2013/AnimationsSample.vcxproj.filters | 2 +- src/bluecadet/views/AnimOperators.h | 66 +++++++++---------- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj b/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj index 335a6d4..b175603 100644 --- a/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj +++ b/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj @@ -230,7 +230,7 @@ - + diff --git a/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj.filters b/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj.filters index 3172875..f74afe6 100644 --- a/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj.filters +++ b/samples/AnimationsSample/vc2013/AnimationsSample.vcxproj.filters @@ -268,7 +268,7 @@ Header Files - + Blocks\BluecadetViews\src\bluecadet\views diff --git a/src/bluecadet/views/AnimOperators.h b/src/bluecadet/views/AnimOperators.h index 97eba44..684194f 100644 --- a/src/bluecadet/views/AnimOperators.h +++ b/src/bluecadet/views/AnimOperators.h @@ -7,27 +7,27 @@ // template -T operator + (const ci::Anim & tween, const T & value) { +inline T operator + (const ci::Anim & tween, const T & value) { return tween.value() + value; } template -T operator - (const ci::Anim & tween, const T & value) { +inline T operator - (const ci::Anim & tween, const T & value) { return tween.value() - value; } template -T operator * (const ci::Anim & tween, const T & value) { +inline T operator * (const ci::Anim & tween, const T & value) { return tween.value() * value; } template -T operator / (const ci::Anim & tween, const T & value) { +inline T operator / (const ci::Anim & tween, const T & value) { return tween.value() / value; } template -T operator - (const ci::Anim & tween) { +inline T operator - (const ci::Anim & tween) { return -tween.value(); } @@ -36,22 +36,22 @@ T operator - (const ci::Anim & tween) { // template -T operator + (const T & value, const ci::Anim & tween) { +inline T operator + (const T & value, const ci::Anim & tween) { return tween.value() + value; } template -T operator - (const T & value, const ci::Anim & tween) { +inline T operator - (const T & value, const ci::Anim & tween) { return tween.value() - value; } template -T operator * (const T & value, const ci::Anim & tween) { +inline T operator * (const T & value, const ci::Anim & tween) { return tween.value() * value; } template -T operator / (const T & value, const ci::Anim & tween) { +inline T operator / (const T & value, const ci::Anim & tween) { return tween.value() / value; } @@ -61,22 +61,22 @@ T operator / (const T & value, const ci::Anim & tween) { // template -T operator + (const U & value, const ci::Anim & tween) { +inline T operator + (const U & value, const ci::Anim & tween) { return value + tween.value(); } template -T operator - (const U & value, const ci::Anim & tween) { +inline T operator - (const U & value, const ci::Anim & tween) { return value - tween.value(); } template -T operator * (const U & value, const ci::Anim & tween) { +inline T operator * (const U & value, const ci::Anim & tween) { return value * tween.value(); } template -T operator / (const U & value, const ci::Anim & tween) { +inline T operator / (const U & value, const ci::Anim & tween) { return value / tween.value(); } @@ -86,22 +86,22 @@ T operator / (const U & value, const ci::Anim & tween) { // template -T operator + (const ci::Anim & tween, const U & value) { +inline T operator + (const ci::Anim & tween, const U & value) { return value + tween.value(); } template -T operator - (const ci::Anim & tween, const U & value) { +inline T operator - (const ci::Anim & tween, const U & value) { return value - tween.value(); } template -T operator * (const ci::Anim & tween, const U & value) { +inline T operator * (const ci::Anim & tween, const U & value) { return value * tween.value(); } template -T operator / (const ci::Anim & tween, const U & value) { +inline T operator / (const ci::Anim & tween, const U & value) { return value / tween.value(); } @@ -111,22 +111,22 @@ T operator / (const ci::Anim & tween, const U & value) { // template -T operator + (const ci::Anim & lhs, const ci::Anim & rhs) { +inline T operator + (const ci::Anim & lhs, const ci::Anim & rhs) { return lhs.value() + rhs.value(); } template -T operator - (const ci::Anim & lhs, const ci::Anim & rhs) { +inline T operator - (const ci::Anim & lhs, const ci::Anim & rhs) { return lhs.value() - rhs.value(); } template -T operator * (const ci::Anim & lhs, const ci::Anim & rhs) { +inline T operator * (const ci::Anim & lhs, const ci::Anim & rhs) { return lhs.value() * rhs.value(); } template -T operator / (const ci::Anim & lhs, const ci::Anim & rhs) { +inline T operator / (const ci::Anim & lhs, const ci::Anim & rhs) { return lhs.value() / rhs.value(); } @@ -136,22 +136,22 @@ T operator / (const ci::Anim & lhs, const ci::Anim & rhs) { // template -bool operator == (const ci::Anim & tween, const T & value) { +inline bool operator == (const ci::Anim & tween, const T & value) { return tween.value() == value; } template -bool operator == (const T & value, const ci::Anim & tween) { +inline bool operator == (const T & value, const ci::Anim & tween) { return value == tween.value(); } template -bool operator != (const ci::Anim & tween, const T & value) { +inline bool operator != (const ci::Anim & tween, const T & value) { return tween.value() != value; } template -bool operator != (const T & value, const ci::Anim & tween) { +inline bool operator != (const T & value, const ci::Anim & tween) { return value != tween.value(); } @@ -161,44 +161,44 @@ bool operator != (const T & value, const ci::Anim & tween) { // template -bool operator > (const ci::Anim & tween, const T & value) { +inline bool operator > (const ci::Anim & tween, const T & value) { return tween.value() > value; } template -bool operator > (const T & value, const ci::Anim & tween) { +inline bool operator > (const T & value, const ci::Anim & tween) { return value > tween.value(); } template -bool operator < (const ci::Anim & tween, const T & value) { +inline bool operator < (const ci::Anim & tween, const T & value) { return tween.value() < value; } template -bool operator < (const T & value, const ci::Anim & tween) { +inline bool operator < (const T & value, const ci::Anim & tween) { return value < tween.value(); } template -bool operator >= (const ci::Anim & tween, const T & value) { +inline bool operator >= (const ci::Anim & tween, const T & value) { return tween.value() >= value; } template -bool operator >= (const T & value, const ci::Anim & tween) { +inline bool operator >= (const T & value, const ci::Anim & tween) { return value >= tween.value(); } template -bool operator <= (const ci::Anim & tween, const T & value) { +inline bool operator <= (const ci::Anim & tween, const T & value) { return tween.value() <= value; } template -bool operator <= (const T & value, const ci::Anim & tween) { +inline bool operator <= (const T & value, const ci::Anim & tween) { return value <= tween.value(); } From 776d54e5169d677d23ef1e5574f082bedeccf7a7 Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Wed, 26 Jul 2017 19:25:18 -0400 Subject: [PATCH 20/25] Fixed issue with TextViews that have no size set --- src/bluecadet/views/TextView.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bluecadet/views/TextView.cpp b/src/bluecadet/views/TextView.cpp index ef14be8..df48114 100644 --- a/src/bluecadet/views/TextView.cpp +++ b/src/bluecadet/views/TextView.cpp @@ -66,8 +66,9 @@ void TextView::willDraw() { } void TextView::validateContent() { - if (BaseView::getSize() != StyledTextLayout::getMaxSize()) { - StyledTextLayout::setMaxSize(BaseView::getSize()); + const vec2 & viewSize = BaseView::getSize().value(); + if (viewSize != StyledTextLayout::getMaxSize() && viewSize.x > 0 && viewSize.y > 0) { + StyledTextLayout::setMaxSize(viewSize); } } @@ -122,7 +123,7 @@ void TextView::invalidate(const int flags) { const bool contentChanged = (flags & ValidationFlags::CONTENT) == ValidationFlags::CONTENT; StyledTextLayout::invalidate(contentChanged, contentChanged); - mHasInvalidRenderedContent = contentChanged; + mHasInvalidRenderedContent = mHasInvalidRenderedContent || contentChanged; } void TextView::resetRenderedContent() { From 757cd17eb9496dbe0c6e4f89b7b62bda439c8745 Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Wed, 26 Jul 2017 19:44:26 -0400 Subject: [PATCH 21/25] Fixed issues with unset sizes --- src/bluecadet/views/TextView.cpp | 27 +++++++++++++++++++++------ src/bluecadet/views/TextView.h | 7 ++++--- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/bluecadet/views/TextView.cpp b/src/bluecadet/views/TextView.cpp index df48114..70994d9 100644 --- a/src/bluecadet/views/TextView.cpp +++ b/src/bluecadet/views/TextView.cpp @@ -65,11 +65,31 @@ void TextView::willDraw() { } } +void TextView::setSize(const ci::vec2& size) { + BaseView::setSize(size); + StyledTextLayout::setMaxSize(size); +} + +ci::Anim& TextView::getSize() { + validateContent(); + return BaseView::getSize(); +} + void TextView::validateContent() { const vec2 & viewSize = BaseView::getSize().value(); - if (viewSize != StyledTextLayout::getMaxSize() && viewSize.x > 0 && viewSize.y > 0) { + const vec2 & maxSize = StyledTextLayout::getMaxSize(); + const vec2 & textSize = StyledTextLayout::getTextSize(); + + bool hasMaxSize = maxSize.x >= 0 || maxSize.y >= 0; + bool hasViewSize = viewSize.x > 0 || viewSize.y > 0; + + if (hasMaxSize && hasViewSize) { StyledTextLayout::setMaxSize(viewSize); + } else { + BaseView::setSize(textSize); } + + StyledTextLayout::validateSize(); } void TextView::draw() { @@ -131,11 +151,6 @@ void TextView::resetRenderedContent() { mSurface = ci::Surface(); } -void TextView::setSize(const ci::vec2& size) { - BaseView::setSize(size); - setMaxSize(size); -} - ci::gl::Texture::Format TextView::createTextureFormat(bool smoothScaling) const { gl::Texture::Format format; format.immutableStorage(true); diff --git a/src/bluecadet/views/TextView.h b/src/bluecadet/views/TextView.h index c01b75e..6b6e127 100644 --- a/src/bluecadet/views/TextView.h +++ b/src/bluecadet/views/TextView.h @@ -60,7 +60,8 @@ class TextView : public BaseView, public text::StyledTextLayout { void setPremultiplied(const bool value) { mPremultiplied = value; } //! Sets a fixed, max size for the text view. Any values below 0 will allow the text view to automatically expand in that direction. - void setSize(const ci::vec2& size) override; + void setSize(const ci::vec2& size) override; + ci::Anim & getSize() override; protected: @@ -71,14 +72,14 @@ class TextView : public BaseView, public text::StyledTextLayout { ci::gl::Texture::Format createTextureFormat(bool smoothScaling) const; void validateContent() override; - void invalidate(const bool layout = true, const bool size = true) override; + void invalidate(const bool layout, const bool) override; void invalidate(const int flags) override; // Change visibility of these methods from public to protected since setSize()/getSize() should be used. void setMaxSize(const ci::vec2& size) override { return StyledTextLayout::setMaxSize(size); }; void setMaxWidth(const float value) override { return StyledTextLayout::setMaxWidth(value); }; void setMaxHeight(const float value) override { return StyledTextLayout::setMaxHeight(value); }; - ci::vec2 getMaxSize() const override { return StyledTextLayout::getMaxSize(); }; + const ci::vec2 & getMaxSize() const override { return StyledTextLayout::getMaxSize(); }; float getMaxWidth() const override { return StyledTextLayout::getMaxWidth(); }; float getMaxHeight() const override { return StyledTextLayout::getMaxHeight(); }; From c09d5e13e0042dbc52cd971456510fa6583fc68b Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Wed, 26 Jul 2017 20:07:57 -0400 Subject: [PATCH 22/25] Fixed ci::Anim - U operator (order was flipped) --- src/bluecadet/views/AnimOperators.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bluecadet/views/AnimOperators.h b/src/bluecadet/views/AnimOperators.h index 684194f..1a466dc 100644 --- a/src/bluecadet/views/AnimOperators.h +++ b/src/bluecadet/views/AnimOperators.h @@ -87,22 +87,22 @@ inline T operator / (const U & value, const ci::Anim & tween) { template inline T operator + (const ci::Anim & tween, const U & value) { - return value + tween.value(); + return tween.value() + value; } template inline T operator - (const ci::Anim & tween, const U & value) { - return value - tween.value(); + return tween.value() - value; } template inline T operator * (const ci::Anim & tween, const U & value) { - return value * tween.value(); + return tween.value() * value; } template inline T operator / (const ci::Anim & tween, const U & value) { - return value / tween.value(); + return tween.value() / value; } From d1c1a2f3ca0d3c378c985e1cb0e71f6933bd926a Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Wed, 26 Jul 2017 20:08:18 -0400 Subject: [PATCH 23/25] Image/TextView now properly mark themselves as validated --- src/bluecadet/views/ImageView.cpp | 6 ++++++ src/bluecadet/views/TextView.cpp | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/bluecadet/views/ImageView.cpp b/src/bluecadet/views/ImageView.cpp index 9524707..9ecd15d 100644 --- a/src/bluecadet/views/ImageView.cpp +++ b/src/bluecadet/views/ImageView.cpp @@ -57,6 +57,10 @@ void ImageView::setTexture(ci::gl::TextureRef texture, const bool resizeToTextur } void ImageView::validateContent() { + if (!hasInvalidContent()) { + return; + } + mDrawingDestRect = Rectf(vec2(0), getSize().value()); if (mTexture) { @@ -65,6 +69,8 @@ void ImageView::validateContent() { } else { mDrawingArea = Area(); } + + BaseView::validateContent(); } void ImageView::draw() { diff --git a/src/bluecadet/views/TextView.cpp b/src/bluecadet/views/TextView.cpp index 70994d9..228f3a9 100644 --- a/src/bluecadet/views/TextView.cpp +++ b/src/bluecadet/views/TextView.cpp @@ -76,6 +76,10 @@ ci::Anim& TextView::getSize() { } void TextView::validateContent() { + if (!hasInvalidContent()) { + return; + } + const vec2 & viewSize = BaseView::getSize().value(); const vec2 & maxSize = StyledTextLayout::getMaxSize(); const vec2 & textSize = StyledTextLayout::getTextSize(); @@ -90,6 +94,7 @@ void TextView::validateContent() { } StyledTextLayout::validateSize(); + BaseView::validateContent(); } void TextView::draw() { From 8a8beab14bb4fcfc80208092b93c785fa85376ac Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Wed, 26 Jul 2017 20:14:06 -0400 Subject: [PATCH 24/25] Fixed ci::Anim - T operator (order was flipped) --- src/bluecadet/views/AnimOperators.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bluecadet/views/AnimOperators.h b/src/bluecadet/views/AnimOperators.h index 1a466dc..caf642c 100644 --- a/src/bluecadet/views/AnimOperators.h +++ b/src/bluecadet/views/AnimOperators.h @@ -37,22 +37,22 @@ inline T operator - (const ci::Anim & tween) { template inline T operator + (const T & value, const ci::Anim & tween) { - return tween.value() + value; + return value + tween.value(); } template inline T operator - (const T & value, const ci::Anim & tween) { - return tween.value() - value; + return value - tween.value(); } template inline T operator * (const T & value, const ci::Anim & tween) { - return tween.value() * value; + return value * tween.value(); } template inline T operator / (const T & value, const ci::Anim & tween) { - return tween.value() / value; + return value / tween.value(); } From 6852d12600068684da9de0b8abcdb9d147407da1 Mon Sep 17 00:00:00 2001 From: Benjamin Bojko Date: Thu, 27 Jul 2017 12:47:51 -0400 Subject: [PATCH 25/25] Fixed issues with textview width/height 0; Expanded on textview sample --- .../TextViewSample/src/TextViewSampleApp.cpp | 76 ++++++++++++++----- .../vc2013/TextViewSample.vcxproj | 3 +- src/bluecadet/views/BaseView.h | 2 +- src/bluecadet/views/TextView.cpp | 37 ++++++--- src/bluecadet/views/TextView.h | 8 +- 5 files changed, 91 insertions(+), 35 deletions(-) diff --git a/samples/TextViewSample/src/TextViewSampleApp.cpp b/samples/TextViewSample/src/TextViewSampleApp.cpp index af02913..1c159f1 100644 --- a/samples/TextViewSample/src/TextViewSampleApp.cpp +++ b/samples/TextViewSample/src/TextViewSampleApp.cpp @@ -17,7 +17,7 @@ class TextViewSampleApp : public BaseApp { public: static void prepareSettings(ci::app::App::Settings* settings); void setup() override; - void mouseMove(MouseEvent event) override; + void update() override; TextViewRef mTextView; }; @@ -25,6 +25,8 @@ void TextViewSampleApp::prepareSettings(ci::app::App::Settings* settings) { SettingsManager::getInstance()->setup(settings, "", [](SettingsManager * manager) { manager->mFullscreen = false; manager->mWindowSize = ivec2(1280, 720); + manager->mMinimizeParams = false; + manager->mCollapseParams = true; }); } @@ -32,22 +34,17 @@ void TextViewSampleApp::setup() { BaseApp::setup(); - // Get the params out of the way - SettingsManager::getInstance()->getParams()->minimize(); - // Optional: configure the size and background of your root view getRootView()->setBackgroundColor(Color::gray(0.5f)); - getRootView()->setSize(ScreenLayout::getInstance()->getAppSize()); // Sample content mTextView = TextViewRef(new TextView()); - // Setting only the width will cause the text to break and flow automatically. This is the same as calling setSize(400, -1) - mTextView->setWidth(400.0f); - //mTextView->setHeight(400.0f); // this would cause any text beyond 400 px to be cut off vertically + mTextView->setWidth(500.0f); // This will cause the text to break and flow automatically. This is the same as calling setSize(400, 0) + //mTextView->setHeight(500.0f); // This will cause any text beyond 400 px to be cut off vertically // Background color is independent of text styles - mTextView->setBackgroundColor(ColorA(1, 0, 1, 0.75f)); + mTextView->setBackgroundColor(ColorA(1.0f, 0, 0.5f, 0.75f)); // Set all styles before setting your text mTextView->setTextColor(Color(1.0f, 1.0f, 1.0f)); @@ -55,20 +52,61 @@ void TextViewSampleApp::setup() { mTextView->setTextAlign(TextAlign::Center); // All styles will be applied to text now - mTextView->setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nec vero alia sunt quaerenda contra Carneadeam illam sententiam. Atque haec coniunctio confusioque virtutum tamen a philosophis ratione quadam distinguitur. "); - - // Set new styles for additional text - mTextView->setTextColor(Color(0.25f, 0.25f, 1.0f)); - //mTextView->setTextColor(Color(0.25f, 0.25f, 1.0f), true); // this would apply the text color to all existing text - mTextView->appendText("Sit hoc ultimum bonorum, quod nunc a me defenditur; Duo Reges: constructio interrete. Quid est, quod ab ea absolvi et perfici debeat? Nunc haec primum fortasse audientis servire debemus. Scaevola tribunus plebis ferret ad plebem vellentne de ea re quaeri. Sed in rebus apertissimis nimium longi sumus."); + mTextView->setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n\nNec vero alia sunt quaerenda contra Carneadeam illam sententiam. Atque haec coniunctio confusioque virtutum tamen a philosophis ratione quadam distinguitur. "); + + // Configure debug parameters + static int clipMode = mTextView->getClipMode(); + static vector clipModes = {"Clip", "No Clip"}; + + static int layoutMode = mTextView->getLayoutMode(); + static vector layoutModes = {"Word Wrap", "No Wrap", "Single Line"}; + + static int textAlign = mTextView->getCurrentStyle().mTextAlign; + static vector textAligns = {"Left", "Right", "Center"}; + + auto params = SettingsManager::getInstance()->getParams(); + params->setSize(params->getSize() + ivec2(0, 200)); + + params->addSeparator(); + params->addParam("Clip Mode", clipModes, &clipMode).updateFn([&]() { mTextView->setClipMode((StyledTextLayout::ClipMode)clipMode); }); + params->addParam("Layout Mode", layoutModes, &layoutMode).updateFn([&]() { mTextView->setLayoutMode((StyledTextLayout::LayoutMode)layoutMode); }); + params->addParam("Text Align", textAligns, &textAlign).updateFn([&]() { mTextView->setTextAlign((TextAlign)textAlign); }); + params->addParam("Trim Text Size", [&](bool v) { mTextView->setSizeTrimmingEnabled(v); }, [&] { return mTextView->getSizeTrimmingEnabled(); }); + params->addSeparator(); + params->addButton("Set to Auto-Width", [&] { mTextView->setWidth(0); }); + params->addButton("Set to Auto-Height", [&] { mTextView->setHeight(0); }); + params->addSeparator(); + params->addParam("View Width", [&](float v) { mTextView->setWidth(v); }, [&] { return mTextView->getWidth(); }); + params->addParam("View Height", [&](float v) { mTextView->setHeight(v); }, [&] { return mTextView->getHeight(); }); + params->addSeparator(); + params->addParam("Padding Top", [&](float v) { mTextView->setPaddingTop(v); }, [&] { return mTextView->getPaddingTop(); }); + params->addParam("Padding Right", [&](float v) { mTextView->setPaddingRight(v); }, [&] { return mTextView->getPaddingRight(); }); + params->addParam("Padding Bottom", [&](float v) { mTextView->setPaddingBottom(v); }, [&] { return mTextView->getPaddingBottom(); }); + params->addParam("Padding Left", [&](float v) { mTextView->setPaddingLeft(v); }, [&] { return mTextView->getPaddingLeft(); }); + params->addSeparator(); + params->addParam("Leading Disabled", [&](bool v) { mTextView->setLeadingDisabled(v); }, [&] { return mTextView->getLeadingDisabled(); }); + params->addParam("Leading Offset", [&](float v) { mTextView->setLeadingOffset(v); }, [&] { return mTextView->getCurrentStyle().mLeadingOffset; }).step(1); + params->addSeparator(); + params->addParam("Max Width (read only)", [&](float v) {}, [&] { return mTextView->getMaxWidth(); }); + params->addParam("Max Height (read only)", [&](float v) {}, [&] { return mTextView->getMaxHeight(); }); + params->addParam("Text Width (read only)", [&](float v) {}, [&] { return mTextView->getTextWidth(); }); + params->addParam("Text Height (read only)", [&](float v) {}, [&] { return mTextView->getTextHeight(); }); + params->addSeparator(); getRootView()->addChild(mTextView); } -void TextViewSampleApp::mouseMove(MouseEvent event) { - float x = event.getX(); - mTextView->setWidth(x - mTextView->getPosition().value().x); +void TextViewSampleApp::update() { + BaseApp::update(); + + mTextView->setPosition((vec2(getWindowSize()) - mTextView->getSize()) * 0.5f); + + static bool initialized = false; + if (!initialized) { + initialized = true; + auto params = SettingsManager::getInstance()->getParams(); + params->setPosition(vec2(getWindowWidth() - params->getWidth() - params->getPosition().x, params->getPosition().y)); + } } -// Make sure to pass a reference to prepareSettings to configure the app correctly. MSAA and other render options are optional. CINDER_APP(TextViewSampleApp, RendererGl(RendererGl::Options().msaa(4)), TextViewSampleApp::prepareSettings); diff --git a/samples/TextViewSample/vc2013/TextViewSample.vcxproj b/samples/TextViewSample/vc2013/TextViewSample.vcxproj index fe408c9..96c76f7 100644 --- a/samples/TextViewSample/vc2013/TextViewSample.vcxproj +++ b/samples/TextViewSample/vc2013/TextViewSample.vcxproj @@ -78,6 +78,7 @@ Level3 ProgramDatabase true + false true @@ -88,13 +89,13 @@ cinder.lib;OpenGL32.lib;%(AdditionalDependencies) "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)\" - false true Windows true false + false diff --git a/src/bluecadet/views/BaseView.h b/src/bluecadet/views/BaseView.h index 1ebb2e0..7661f8a 100644 --- a/src/bluecadet/views/BaseView.h +++ b/src/bluecadet/views/BaseView.h @@ -194,7 +194,7 @@ class BaseView : public std::enable_shared_from_this { //! Size of this view. Defaults to 0, 0 and is not affected by children. Does not affect transforms (position, rotation, scale). virtual ci::Anim & getSize() { return mSize; } - virtual void setSize(const ci::vec2 & size) { mSize = size; invalidate(ValidationFlags::CONTENT); } + virtual void setSize(const ci::vec2 & size) { if (mSize != size) { mSize = size; invalidate(ValidationFlags::CONTENT); } } //! Width of this view. Defaults to 0 and is not affected by children. virtual float getWidth() { return getSize().value().x; } diff --git a/src/bluecadet/views/TextView.cpp b/src/bluecadet/views/TextView.cpp index 228f3a9..5cde944 100644 --- a/src/bluecadet/views/TextView.cpp +++ b/src/bluecadet/views/TextView.cpp @@ -70,6 +70,16 @@ void TextView::setSize(const ci::vec2& size) { StyledTextLayout::setMaxSize(size); } +void TextView::setWidth(float value) { + BaseView::setSize(vec2(value, getHeight())); + StyledTextLayout::setMaxSize(vec2(value, getMaxHeight())); +} + +void TextView::setHeight(float value) { + BaseView::setSize(vec2(getWidth(), value)); + StyledTextLayout::setMaxSize(vec2(getMaxWidth(), value)); +} + ci::Anim& TextView::getSize() { validateContent(); return BaseView::getSize(); @@ -80,20 +90,27 @@ void TextView::validateContent() { return; } - const vec2 & viewSize = BaseView::getSize().value(); - const vec2 & maxSize = StyledTextLayout::getMaxSize(); - const vec2 & textSize = StyledTextLayout::getTextSize(); - - bool hasMaxSize = maxSize.x >= 0 || maxSize.y >= 0; - bool hasViewSize = viewSize.x > 0 || viewSize.y > 0; + // Check if max size should be changed to view size + vec2 viewSize = BaseView::getSize().value(); + vec2 maxSize = StyledTextLayout::getMaxSize(); - if (hasMaxSize && hasViewSize) { - StyledTextLayout::setMaxSize(viewSize); - } else { - BaseView::setSize(textSize); + if (viewSize.x > 0 && maxSize.x > 0) { + maxSize.x = viewSize.x; + } + if (viewSize.y > 0 && maxSize.y > 0) { + maxSize.x = viewSize.x; } + StyledTextLayout::setMaxSize(maxSize); StyledTextLayout::validateSize(); + + // Check if view size should be changed to text size + const vec2 & textSize = StyledTextLayout::getTextSize(); + + viewSize.x = glm::max(maxSize.x, textSize.x); + viewSize.y = glm::max(maxSize.y, textSize.y); + + BaseView::setSize(viewSize); BaseView::validateContent(); } diff --git a/src/bluecadet/views/TextView.h b/src/bluecadet/views/TextView.h index 6b6e127..9f0aa61 100644 --- a/src/bluecadet/views/TextView.h +++ b/src/bluecadet/views/TextView.h @@ -60,7 +60,10 @@ class TextView : public BaseView, public text::StyledTextLayout { void setPremultiplied(const bool value) { mPremultiplied = value; } //! Sets a fixed, max size for the text view. Any values below 0 will allow the text view to automatically expand in that direction. - void setSize(const ci::vec2& size) override; + void setSize(const ci::vec2& size) override; + void setWidth(const float value) override; + void setHeight(const float value) override; + ci::Anim & getSize() override; @@ -79,9 +82,6 @@ class TextView : public BaseView, public text::StyledTextLayout { void setMaxSize(const ci::vec2& size) override { return StyledTextLayout::setMaxSize(size); }; void setMaxWidth(const float value) override { return StyledTextLayout::setMaxWidth(value); }; void setMaxHeight(const float value) override { return StyledTextLayout::setMaxHeight(value); }; - const ci::vec2 & getMaxSize() const override { return StyledTextLayout::getMaxSize(); }; - float getMaxWidth() const override { return StyledTextLayout::getMaxWidth(); }; - float getMaxHeight() const override { return StyledTextLayout::getMaxHeight(); }; bool mHasInvalidRenderedContent; bool mSmoothScalingEnabled;