diff --git a/README.md b/README.md index dc75d5f..c61c1cf 100644 --- a/README.md +++ b/README.md @@ -39,21 +39,20 @@ Please attach this file when asking for support along with any other relevant in ## Code Setup 1. Clone the repo with all of its submodules with: `git clone https://github.com/cwhitney/SilverSprint.git --depth 1 --recursive` -2. Build Cinder for your platform [OS X](https://libcinder.org/docs/guides/mac-setup/index.html) - [Windows](https://libcinder.org/docs/guides/windows-setup/index.html). +1. Build Cinder for your platform [OS X](https://libcinder.org/docs/guides/mac-setup/index.html) - [Windows](https://libcinder.org/docs/guides/windows-setup/index.html). If you're having trouble building Cinder, it may be missing some of its dependencies. You may need to run `git submodule update --init --recursive` to make sure Cinder has all of its submodules. -3. The structure of the repo is like so: - -``` -Root - - apps - - Arduino - - SilverSprints - - libs - - Cinder -``` -4. Update Arduino if necessary. (See above.) -5. Open the project file for your platform. It will be in `apps/SilverSprints/xcode/SilverSprint.xcodeproj` for OS X, and `apps/SilverSprints/vs2015` for PC. -6. Build SilverSprints. There are no external dependencies aside from Cinder itself. +1. The structure of the repo is like so: + ``` + Root + - apps + - Arduino + - SilverSprints + - libs + - Cinder + ``` +1. Update Arduino if necessary. (See above.) +1. Open the project file for your platform. It will be in `apps/SilverSprints/xcode/SilverSprint.xcodeproj` for OS X, and `apps/SilverSprints/vs2015` for PC. +1. Build SilverSprints. There are no external dependencies aside from Cinder itself. ## Credits diff --git a/apps/SilverSprints/src/SilverSprintsApp.cpp b/apps/SilverSprints/src/SilverSprintsApp.cpp index 064305a..706c4bd 100644 --- a/apps/SilverSprints/src/SilverSprintsApp.cpp +++ b/apps/SilverSprints/src/SilverSprintsApp.cpp @@ -49,7 +49,7 @@ void SilverSprintApp::setup() #endif auto sysLogger = log::makeLogger(); - sysLogger->setLoggingLevel(log::LEVEL_VERBOSE); + sysLogger->setLevel(log::LEVEL_VERBOSE); CI_LOG_I("Start program"); diff --git a/apps/Silversprints/blocks/OSC/src/cinder/osc/Osc.cpp b/apps/Silversprints/blocks/OSC/src/cinder/osc/Osc.cpp index e54f1bf..2b9a458 100644 --- a/apps/Silversprints/blocks/OSC/src/cinder/osc/Osc.cpp +++ b/apps/Silversprints/blocks/OSC/src/cinder/osc/Osc.cpp @@ -1525,7 +1525,7 @@ void ReceiverTcp::accept( OnAcceptErrorFn onAcceptErrorFn, OnAcceptFn onAcceptFn if( ! mAcceptor || ! mAcceptor->is_open() ) return; - auto socket = std::make_shared( mAcceptor->get_io_service() ); + auto socket = std::make_shared( mAcceptor->get_executor() ); mAcceptor->async_accept( *socket, std::bind( [&, onAcceptErrorFn, onAcceptFn]( TcpSocketRef socket, const asio::error_code &error ) { @@ -1771,4 +1771,4 @@ void calcOffsetFromSystem( uint64_t ntpTime, int64_t *localOffsetSecs, int64_t * } // namespace osc -} // namespace cinder \ No newline at end of file +} // namespace cinder diff --git a/apps/Silversprints/blocks/OSC/src/cinder/osc/Osc.h b/apps/Silversprints/blocks/OSC/src/cinder/osc/Osc.h index aed175f..4a1e316 100644 --- a/apps/Silversprints/blocks/OSC/src/cinder/osc/Osc.h +++ b/apps/Silversprints/blocks/OSC/src/cinder/osc/Osc.h @@ -499,14 +499,14 @@ class SenderUdp : public SenderBase { const std::string &destinationHost, uint16_t destinationPort, const protocol &protocol = protocol::v4(), - asio::io_service &service = ci::app::App::get()->io_service() ); + asio::io_service &service = ci::app::App::get()->io_context() ); //! Constructs a Sender (called a \a server in the OSC spec) using UDP as transport, whose local endpoint is //! defined by \a localPort and \a protocol, which defaults to v4, and remote endpoint is defined by \a //! destination. Takes an optional io_service, used to construct the socket from. SenderUdp( uint16_t localPort, const protocol::endpoint &destination, const protocol &protocol = protocol::v4(), - asio::io_service &service = ci::app::App::get()->io_service() ); + asio::io_service &service = ci::app::App::get()->io_context() ); //! Constructs a Sender (called a \a server in the OSC spec) using UDP for transport, with an already created //! udp::socket shared_ptr \a socket and remote endpoint \a destination. This constructor is good for using //! already constructed sockets for more indepth configuration. Expects the local endpoint to be constructed. @@ -562,7 +562,7 @@ class SenderTcp : public SenderBase { const std::string &destinationHost, uint16_t destinationPort, const protocol &protocol = protocol::v4(), - asio::io_service &service = ci::app::App::get()->io_service(), + asio::io_service &service = ci::app::App::get()->io_context(), PacketFramingRef packetFraming = nullptr ); //! Constructs a Sender (called a \a server in the OSC spec) using TCP as transport, whose local endpoint is //! defined by \a localPort and \a protocol, which defaults to v4, and remote endpoint is defined by \a @@ -571,7 +571,7 @@ class SenderTcp : public SenderBase { SenderTcp( uint16_t localPort, const protocol::endpoint &destination, const protocol &protocol = protocol::v4(), - asio::io_service &service = ci::app::App::get()->io_service(), + asio::io_service &service = ci::app::App::get()->io_context(), PacketFramingRef packetFraming = nullptr ); //! Constructs a Sender (called a \a server in the OSC spec) using TCP as transport, with an already created //! tcp::socket shared_ptr \a socket, and remote endpoint is defined by \a destination and PacketFraming @@ -690,11 +690,11 @@ class ReceiverUdp : public ReceiverBase { //! construct the socket from. ReceiverUdp( uint16_t port, const protocol &protocol = protocol::v4(), - asio::io_service &io = ci::app::App::get()->io_service() ); + asio::io_service &io = ci::app::App::get()->io_context() ); //! Constructs a Receiver (called a \a client in the OSC spec) using UDP for transport, whose local endpoint //! is defined by \a localEndpoint. Takes an optional io_service to construct the socket from. ReceiverUdp( const protocol::endpoint &localEndpoint, - asio::io_service &io = ci::app::App::get()->io_service() ); + asio::io_service &io = ci::app::App::get()->io_context() ); //! Constructs a Receiver (called a \a client in the OSC spec) using UDP for transport, from the already //! constructed udp::socket shared_ptr \a socket. Use this for extra configuration and or sharing sockets //! between sender and receiver. @@ -762,13 +762,13 @@ class ReceiverTcp : public ReceiverBase { //! to construct the socket from. ReceiverTcp( uint16_t port, const protocol &protocol = protocol::v4(), - asio::io_service &service = ci::app::App::get()->io_service(), + asio::io_service &service = ci::app::App::get()->io_context(), PacketFramingRef packetFraming = nullptr ); //! Constructs a Receiver (called a \a client in the OSC spec) using TCP for transport, whose local endpoint //! is defined by \a localEndpoint and PacketFraming shared_ptr \a packetFraming, which defaults to null. Takes //! an optional io_service to construct the socket from. ReceiverTcp( const protocol::endpoint &localEndpoint, - asio::io_service &service = ci::app::App::get()->io_service(), + asio::io_service &service = ci::app::App::get()->io_context(), PacketFramingRef packetFraming = nullptr ); //! Constructs a Receiver (called a \a client in the OSC spec) using TCP for transport, from the already //! constructed tcp::acceptor shared_ptr \a acceptor and PacketFraming shared_ptr \a packetFraming, which @@ -913,4 +913,4 @@ namespace time { } // namespace osc -} // namespace cinder \ No newline at end of file +} // namespace cinder diff --git a/apps/Silversprints/include/data/SerialReader.h b/apps/Silversprints/include/data/SerialReader.h index 12ee24c..26e1986 100644 --- a/apps/Silversprints/include/data/SerialReader.h +++ b/apps/Silversprints/include/data/SerialReader.h @@ -14,7 +14,6 @@ #include "cinder/Log.h" #include "cinder/Timeline.h" #include "cinder/ConcurrentCircularBuffer.h" -#include #include "data/StateManager.h" #include "data/Model.h" diff --git a/apps/Silversprints/include/ui/CiTextField.h b/apps/Silversprints/include/ui/CiTextField.h index 92d8332..8d7db7c 100644 --- a/apps/Silversprints/include/ui/CiTextField.h +++ b/apps/Silversprints/include/ui/CiTextField.h @@ -13,7 +13,6 @@ #include "cinder/gl/TextureFont.h" #include "data/Model.h" -#include class CiTextField : public ci::Rectf { public: diff --git a/apps/Silversprints/src/data/SerialReader.cpp b/apps/Silversprints/src/data/SerialReader.cpp index e7a7686..a09f908 100644 --- a/apps/Silversprints/src/data/SerialReader.cpp +++ b/apps/Silversprints/src/data/SerialReader.cpp @@ -241,8 +241,13 @@ void SerialReader::readSerial() void SerialReader::parseCommandToBuffer( std::string command ) { std::vector strs; - boost::split(strs, command, boost::is_any_of(":")); - + std::stringstream ss (command); + std::string item; + + while (getline (ss, item, ':')) { + strs.push_back (item); + } + std::vector tmpBuffer; tmpBuffer.push_back( strs[0] ); @@ -310,7 +315,12 @@ void SerialReader::parseFromBuffer() // RACE PROGRESS (args are race ticks, then race time millis) else if (cmd == "R") { std::vector rdata; - boost::split(rdata, args, boost::is_any_of(",")); + std::stringstream ss (args); + std::string item; + + while (getline (ss, item, ',')) { + rdata.push_back (item); + } int raceMillis = fromString(rdata.back()); //float dt = raceMillis - Model::instance().elapsedRaceTimeMillis; diff --git a/apps/Silversprints/src/ui/CiTextField.cpp b/apps/Silversprints/src/ui/CiTextField.cpp index 70dd7cc..24644d5 100644 --- a/apps/Silversprints/src/ui/CiTextField.cpp +++ b/apps/Silversprints/src/ui/CiTextField.cpp @@ -13,6 +13,26 @@ using namespace ci::app; using namespace std; using namespace gfx; +// trim from start (in place) +static inline void ltrim(std::string &s) { + s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) { + return !std::isspace(ch); + })); +} + +// trim from end (in place) +static inline void rtrim(std::string &s) { + s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) { + return !std::isspace(ch); + }).base(), s.end()); +} + +// trim from both ends (in place) +static inline void trim(std::string &s) { + rtrim(s); + ltrim(s); +} + CiTextField::~CiTextField(){ mMouseDownCb.disconnect(); mMouseDragCb.disconnect(); @@ -227,7 +247,7 @@ void CiTextField::blur(){ bActive = false; - boost::trim(mText); + trim(mText); if( mText !="" ){ enable(); diff --git a/apps/Silversprints/src/ui/RaceText.cpp b/apps/Silversprints/src/ui/RaceText.cpp index 31f6a65..fe5298b 100644 --- a/apps/Silversprints/src/ui/RaceText.cpp +++ b/apps/Silversprints/src/ui/RaceText.cpp @@ -7,7 +7,6 @@ // #include "ui/RaceText.h" -#include #include using namespace gfx; @@ -54,7 +53,7 @@ void RaceText::draw( gfx::PlayerData *data, const ci::vec2 &offset ) gl::color( Color::white() ); // NAME - boost::to_upper(data->player_name); + for (auto & c: data->player_name) c = toupper(c); Model::instance().texFont->drawString(data->player_name, vec2(20, 44), Model::instance().getTfDrawOpts()); // SPEED diff --git a/libs/Cinder b/libs/Cinder index 4bc734c..51c39a5 160000 --- a/libs/Cinder +++ b/libs/Cinder @@ -1 +1 @@ -Subproject commit 4bc734cba1e30fafd24cd24ab6e20b9e93c92ab3 +Subproject commit 51c39a5801f26d2ef45138d8433eca8e32cc6aff