Skip to content

Instantly share code, notes, and snippets.

Andrew Bell andrewfb

Block or report user

Report or block andrewfb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@andrewfb
andrewfb / StreamingBuffer.cpp
Created Feb 26, 2019
Implementation of cinder::StreamingBuffer
View StreamingBuffer.cpp
StreamingBuffer::StreamingBuffer( size_t blockSizeBytes )
: mBlockSize( std::max<size_t>( blockSizeBytes, 1 ) )
{
allocateNewWriteBlock();
mReadOffset = 0;
}
void StreamingBuffer::pushFront( const void *data, size_t dataSize )
{
std::lock_guard<std::mutex> lock( mMutex );
@andrewfb
andrewfb / StreamingBuffer.h
Created Feb 26, 2019
Interface of cinder::StreamingBuffer
View StreamingBuffer.h
class CI_API StreamingBuffer {
public:
StreamingBuffer( size_t blockSizeBytes = 65536 );
StreamingBuffer( const StreamingBuffer &rhs ) = delete;
StreamingBuffer( StreamingBuffer &&rhs ) = delete;
void pushFront( const void *data, size_t sizeBytes );
size_t popBack( void *output, size_t maxSize );
size_t getSize() const;
@andrewfb
andrewfb / gist:5338181
Created Apr 8, 2013
Demonstrates using params::InterfaceGl with multiple windows.
View gist:5338181
#include "cinder/app/AppBasic.h"
#include "cinder/Rand.h"
#include "cinder/params/params.h"
#include <list>
using namespace ci;
using namespace ci::app;
using namespace std;
// We'll create a new Cinder Application by deriving from the AppBasic class
@andrewfb
andrewfb / gist:1872308
Created Feb 20, 2012
Convert a cinder::Shape2d into C++ code that generates its equivalent
View gist:1872308
void outputCinderCode( const Shape2d &shape, const std::string &name )
{
app::console() << "Shape2d " << name << ";" << std::endl;
for( vector<Path2d>::const_iterator pathIt = shape.getContours().begin(); pathIt != shape.getContours().end(); ++pathIt ) {
app::console() << name << ".appendContour( Path2d() );" << std::endl;
size_t pt = 0;
app::console() << name << ".getContours().back().moveTo( " << pathIt->getPoints()[0].x << ", " << pathIt->getPoints()[0].y << " );" << std::endl;
pt++;
for( std::vector<Path2d::SegmentType>::const_iterator segIt = pathIt->getSegments().begin(); segIt != pathIt->getSegments().end(); ++segIt ) {
if( *segIt == Path2d::CLOSE )
You can’t perform that action at this time.