本文整理汇总了C++中ci::params::InterfaceGlRef::addParam方法的典型用法代码示例。如果您正苦于以下问题:C++ InterfaceGlRef::addParam方法的具体用法?C++ InterfaceGlRef::addParam怎么用?C++ InterfaceGlRef::addParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ci::params::InterfaceGlRef
的用法示例。
在下文中一共展示了InterfaceGlRef::addParam方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void HttpClientApp::setup()
{
gl::enable( GL_TEXTURE_2D );
mBytesRead = 0;
mContentLength = 0;
mFont = Font( "Georgia", 24 );
mFrameRate = 0.0f;
mFullScreen = false;
mHost = "127.0.0.1";
mIndex = 0;
mHttpRequest = HttpRequest( "GET", "/", HttpVersion::HTTP_1_1 );
mHttpRequest.setHeader( "Host", mHost );
mHttpRequest.setHeader( "Accept", "*/*" );
mParams = params::InterfaceGl::create( "Params", ivec2( 200, 150 ) );
mParams->addParam( "Frame rate", &mFrameRate, "", true );
mParams->addParam( "Full screen", &mFullScreen ).key( "f" );
mParams->addParam( "Image index", &mIndex, "min=0 max=3 step=1 keyDecr=i keyIncr=I" );
mParams->addParam( "Host", &mHost );
mParams->addButton( "Write", [ & ]() { write(); }, "key=w" );
mParams->addButton( "Quit", [ & ]() { quit(); }, "key=q" );
mClient = TcpClient::create( io_service() );
mClient->connectConnectEventHandler( &HttpClientApp::onConnect, this );
mClient->connectErrorEventHandler( &HttpClientApp::onError, this );
mClient->connectResolveEventHandler( &HttpClientApp::onResolve, this );
}
示例2: setup
void ServerApp::setup()
{
mFrameRate = 0.0f;
mFullScreen = false;
mMessage = "Hello, client!";
gl::enable( GL_TEXTURE_2D );
mFont = Font( "Georgia", 80 );
mSize = Vec2f( getWindowSize() );
mText = "Listening...";
mTextPrev = "";
mServer.addConnectCallback( &ServerApp::onConnect, this );
mServer.addDisconnectCallback( &ServerApp::onDisconnect, this );
mServer.addErrorCallback( &ServerApp::onError, this );
mServer.addInterruptCallback( &ServerApp::onInterrupt, this );
mServer.addPingCallback( &ServerApp::onPing, this );
mServer.addReadCallback( &ServerApp::onRead, this );
mParams = params::InterfaceGl::create( "SERVER", Vec2i( 200, 100 ) );
mParams->addParam( "Frame rate", &mFrameRate, "", true );
mParams->addParam( "Fullscreen", &mFullScreen, "key=f" );
mParams->addParam( "Message", &mMessage );
mParams->addButton( "Write", bind( &ServerApp::write, this ), "key=w" );
mParams->addButton( "Quit", bind( &ServerApp::quit, this ), "key=q" );
mServer.listen( 9002 );
}
示例3: setup
void WebClientApp::setup()
{
gl::enable( GL_TEXTURE_2D );
mFont = Font( "Georgia", 24 );
mFrameRate = 0.0f;
mFullScreen = false;
mHost = "libcinder.org";
mPort = 80;
mHttpRequest = HttpRequest( "GET", "/", HttpVersion::HTTP_1_0 );
mHttpRequest.setHeader( "Host", mHost );
mHttpRequest.setHeader( "Accept", "*/*" );
mHttpRequest.setHeader( "Connection", "close" );
mParams = params::InterfaceGl::create( "Params", ivec2( 200, 150 ) );
mParams->addParam( "Frame rate", &mFrameRate, "", true );
mParams->addParam( "Full screen", &mFullScreen ).key( "f" );
mParams->addParam( "Host", &mHost );
mParams->addParam( "Port", &mPort, "min=0 max=65535 step=1 keyDecr=p keyIncr=P" );
mParams->addButton( "Write", bind( &WebClientApp::write, this ), "key=w" );
mParams->addButton( "Quit", bind( &WebClientApp::quit, this ), "key=q" );
mClient = TcpClient::create( io_service() );
mClient->connectConnectEventHandler( &WebClientApp::onConnect, this );
mClient->connectErrorEventHandler( &WebClientApp::onError, this );
mClient->connectResolveEventHandler( &WebClientApp::onResolve, this );
}
示例4: setup
void BasicApp::setup()
{
gl::enable( GL_TEXTURE_2D );
mFrameRate = 0.0f;
mFullScreen = false;
mDevice = Kinect2::Device::create();
mDevice->start();
mDevice->connectBodyIndexEventHandler( [ & ]( const Kinect2::BodyIndexFrame& frame )
{
mChannelBodyIndex = frame.getChannel();
} );
mDevice->connectColorEventHandler( [ & ]( const Kinect2::ColorFrame& frame )
{
mSurfaceColor = frame.getSurface();
} );
mDevice->connectDepthEventHandler( [ & ]( const Kinect2::DepthFrame& frame )
{
mChannelDepth = frame.getChannel();
} );
mDevice->connectInfraredEventHandler( [ & ]( const Kinect2::InfraredFrame& frame )
{
mChannelInfrared = frame.getChannel();
} );
mParams = params::InterfaceGl::create( "Params", ivec2( 200, 100 ) );
mParams->addParam( "Frame rate", &mFrameRate, "", true );
mParams->addParam( "Full screen", &mFullScreen ).key( "f" );
mParams->addButton( "Quit", [ & ]() { quit(); } , "key=q" );
}
示例5: setup
void MultiUdpClientApp::setup()
{
gl::enableAlphaBlending();
gl::enable( GL_TEXTURE_2D );
mFont = Font( "Georgia", 24 );
mFrameRate = 0.0f;
mFullScreen = false;
mHost = "127.0.0.1";
mPortLocal = 0;
mPortRemote = 2000;
mRequest = "Hello, server!";
mParams = params::InterfaceGl::create( "Params", ivec2( 200, 150 ) );
mParams->addParam( "Frame rate", &mFrameRate, "", true );
mParams->addParam( "Full screen", &mFullScreen, "key=f" );
mParams->addParam( "Host", &mHost );
mParams->addParam( "Port", &mPortRemote,
"min=0 max=65535 step=1 keyDecr=p keyIncr=P" );
mParams->addParam( "Request", &mRequest );
mParams->addButton( "Write", bind( &MultiUdpClientApp::write, this ), "key=w" );
mParams->addButton( "Quit", bind( &MultiUdpClientApp::quit, this ), "key=q" );
mClient = UdpClient::create( io_service() );
mServer = UdpServer::create( io_service() );
mClient->connectConnectEventHandler( &MultiUdpClientApp::onConnect, this );
mClient->connectErrorEventHandler( &MultiUdpClientApp::onError, this );
mClient->connectResolveEventHandler( &MultiUdpClientApp::onResolve, this );
mServer->connectAcceptEventHandler( &MultiUdpClientApp::onAccept, this );
mServer->connectErrorEventHandler( &MultiUdpClientApp::onError, this );
}
示例6: setup
void FaceApp::setup()
{
gl::enableAlphaBlending();
mEnabledFace2d = true;
mEnabledFace3d = true;
mFrameRate = 0.0f;
mFullScreen = false;
mDevice = Kinect2::Device::create();
mDevice->start();
mDevice->enableFaceMesh();
mDevice->connectBodyEventHandler( [ & ]( const Kinect2::BodyFrame frame )
{
} );
mDevice->connectColorEventHandler( [ & ]( const Kinect2::ColorFrame frame )
{
mSurface = frame.getSurface();
} );
mParams = params::InterfaceGl::create( "Params", Vec2i( 230, 130 ) );
mParams->addParam( "Frame rate", &mFrameRate, "", true );
mParams->addParam( "Full screen", &mFullScreen ).key( "f" );
mParams->addParam( "2d face tracking", &mEnabledFace2d ).key( "2" );
mParams->addParam( "3d face tracking", &mEnabledFace3d ).key( "3" );
mParams->addButton( "Quit", [ & ]() { quit(); } , "key=q" );
}
示例7: setup
void ClientApp::setup()
{
gl::enable( GL_TEXTURE_2D );
mFont = Font( "Georgia", 80 );
mSize = Vec2f( getWindowSize() );
mText = "";
mTextPrev = mText;
mClient.addConnectCallback( &ClientApp::onConnect, this );
mClient.addDisconnectCallback( &ClientApp::onDisconnect, this );
mClient.addErrorCallback( &ClientApp::onError, this );
mClient.addInterruptCallback( &ClientApp::onInterrupt, this );
mClient.addPingCallback( &ClientApp::onPing, this );
mClient.addReadCallback( &ClientApp::onRead, this );
mFrameRate = 0.0f;
mFullScreen = false;
mMessage = "Hello, server!";
mPing = false;
mPingTime = getElapsedSeconds();
mParams = params::InterfaceGl::create( "CLIENT", Vec2i( 200, 160 ) );
mParams->addParam( "Frame rate", &mFrameRate, "", true );
mParams->addParam( "Fullscreen", &mFullScreen, "key=f" );
mParams->addParam( "Ping enabled", &mPing, "key=p" );
mParams->addParam( "Message", &mMessage );
mParams->addButton( "Connect", bind( &ClientApp::connect, this ), "key=c" );
mParams->addButton( "Disconnect", bind( &ClientApp::disconnect, this ), "key=d" );
mParams->addButton( "Write", bind( &ClientApp::write, this ), "key=w" );
mParams->addButton( "Quit", bind( &ClientApp::quit, this ), "key=q" );
connect();
}
示例8: setup
void UdpServerApp::setup()
{
gl::enableAlphaBlending();
gl::enable( GL_TEXTURE_2D );
mFont = Font( "Georgia", 24 );
mFrameRate = 0.0f;
mFullScreen = false;
mPort = 2000;
mPortPrev = mPort;
mParams = params::InterfaceGl::create( "Params", ivec2( 200, 110 ) );
mParams->addParam( "Frame rate", &mFrameRate, "", true );
mParams->addParam( "Full screen", &mFullScreen, "key=f" );
mParams->addParam( "Port", &mPort,
"min=0 max=65535 step=1 keyDecr=p keyIncr=P" );
mParams->addButton( "Quit", bind( &UdpServerApp::quit, this ), "key=q" );
// Initialize a server by passing a boost::asio::io_service to it.
// ci::App already has one that it polls on update, so we'll use that.
// You can use your own io_service, but you will have to manage it
// manually (i.e., call poll(), poll_one(), run(), etc).
mServer = UdpServer::create( io_service() );
// Add callbacks to work with the server asynchronously.
mServer->connectAcceptEventHandler( &UdpServerApp::onAccept, this );
mServer->connectErrorEventHandler( &UdpServerApp::onError, this );
// Start listening.
accept();
}
示例9: loadGUI
void CameraComponent::loadGUI(const ci::params::InterfaceGlRef &gui)
{
gui->addSeparator();
gui->addText( mContext->getName() +" : "+ getName());
auto updateFn = std::bind(&CameraComponent::updateCameraParams, this);
gui->addParam( mContext->getName() +" : FOV", &mFov).updateFn(updateFn);
gui->addParam( mContext->getName() +" : Far", &mFar).updateFn(updateFn);
gui->addParam( mContext->getName() +" : Near", &mNear).updateFn(updateFn);
gui->addParam( mContext->getName() +" : Interest Point", &mInterestPoint);
}
示例10: setup
void FtpClientApp::setup()
{
gl::enable( GL_TEXTURE_2D );
mFont = Font( "Georgia", 24 );
mFrameRate = 0.0f;
mFullScreen = false;
mParams = params::InterfaceGl::create( "Params", ivec2( 200, 120 ) );
mParams->addParam( "Frame rate", &mFrameRate, "", true );
mParams->addParam( "Full screen", &mFullScreen, "key=f" );
mParams->addButton( "Quit", [ & ]() { quit(); }, "key=q" );
mConnectionControl = TcpClientConnection::create( io_service() );
mConnectionControl->connect( "www.bantherewind.com", 21 );
}
示例11: setup
void LeapApp::setup()
{
gl::enable( GL_LINE_SMOOTH );
glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
gl::enable( GL_POLYGON_SMOOTH );
glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST );
mCamera = CameraPersp( getWindowWidth(), getWindowHeight(), 60.0f, 1.0f, 1000.0f );
mCamera.lookAt( Vec3f( 0.0f, 250.0f, 500.0f ), Vec3f( 0.0f, 250.0f, 0.0f ) );
mDevice = Device::create();
mDevice->connectEventHandler( &LeapApp::onFrame, this );
mFrameRate = 0.0f;
mFullScreen = false;
mParams = params::InterfaceGl::create( "Params", Vec2i( 200, 105 ) );
mParams->addParam( "Frame rate", &mFrameRate, "", true );
mParams->addParam( "Full screen", &mFullScreen ).key( "f" );
mParams->addButton( "Screen shot", bind( &LeapApp::screenShot, this ), "key=space" );
mParams->addButton( "Quit", bind( &LeapApp::quit, this ), "key=q" );
}
示例12: setup
void TcpClientApp::setup()
{
gl::enableAlphaBlending();
gl::enable( GL_TEXTURE_2D );
mFont = Font( "Georgia", 24 );
mFrameRate = 0.0f;
mFullScreen = false;
mHost = "localhost";
mPort = 2000;
mRequest = "echo";
mParams = params::InterfaceGl::create( "Params", Vec2i( 200, 150 ) );
mParams->addParam( "Frame rate", &mFrameRate, "", true );
mParams->addParam( "Full screen", &mFullScreen, "key=f" );
mParams->addParam( "Host", &mHost );
mParams->addParam( "Port", &mPort,
"min=0 max=65535 step=1 keyDecr=p keyIncr=P" );
mParams->addParam( "Request", &mRequest );
mParams->addButton( "Write", bind( &TcpClientApp::write, this ), "key=w" );
mParams->addButton( "Quit", bind( &TcpClientApp::quit, this ), "key=q" );
// Initialize a client by passing a boost::asio::io_service to it.
// ci::App already has one that it polls on update, so we'll use that.
// You can use your own io_service, but you will have to manage it
// manually (i.e., call poll(), poll_one(), run(), etc).
mClient = TcpClient::create( io_service() );
// Add callbacks to work with the client asynchronously.
// Note that you can use lambdas.
mClient->connectConnectEventHandler( &TcpClientApp::onConnect, this );
mClient->connectErrorEventHandler( &TcpClientApp::onError, this );
mClient->connectResolveEventHandler( [ & ]()
{
mText.push_back( "Endpoint resolved" );
} );
}
示例13: setup
void ImageApp::setup()
{
gl::enable( GL_TEXTURE_2D );
mDevice = Device::create();
mDevice->connectEventHandler( [ & ]( Leap::Frame frame )
{
mFrame = frame;
} );
mFrameRate = 0.0f;
mFullScreen = false;
mParams = params::InterfaceGl::create( "Params", Vec2i( 200, 105 ) );
mParams->addParam( "Frame rate", &mFrameRate, "", true );
mParams->addParam( "Full screen", &mFullScreen ).key( "f" );
mParams->addButton( "Screen shot", [ & ]() { screenShot(); }, "key=space" );
mParams->addButton( "Quit", [ & ]() { quit(); }, "key=q" );
}
示例14: setup
void ImageFileBasicApp::setup()
{
m_params = params::InterfaceGl::create("Params", ivec2(210, 210));
m_params->addParam<bool>("Full Screen", [&](bool b)->void { setFullScreen(b); }, [&]()->bool { return isFullScreen(); }).key("g"); // Fails
m_params->addParam("full screen", &m_bFullscreen).updateFn([this]
{ setFullScreen(m_bFullscreen); CI_LOG_I("m_bFullscreen: " << m_bFullscreen); }).key("h");
try {
fs::path path = getOpenFilePath( "", ImageIo::getLoadExtensions() );
if( ! path.empty() ) {
mTexture = gl::Texture::create( loadImage( path ) );
}
}
catch( Exception &exc ) {
CI_LOG_EXCEPTION( "failed to load image.", exc );
}
}
示例15: loadGUI
void OSCComponent::loadGUI(const ci::params::InterfaceGlRef &gui)
{
gui->addSeparator();
gui->addText( mContext->getName() +" : "+ getName());
auto updateFn = [&]{ mListener.setup(mListenPort); };
gui->addParam("listen port", &mListenPort).updateFn(updateFn);
///TODO:: change osc sender gui update
// auto loadFn = [&]{
// auto tree = ec::ConfigManager::get()->retreiveComponent(ec::Controller::get()->scene().lock()->getName(), mContext->getName(), getName() );
// auto ip = tree["send_ip"].getValue();
// auto port = tree["send_port"].getValue<int>();
// mSendPort = port;
// mSendIp = ip;
// mSender.setup(mSendIp, mSendPort);
// };
// gui->addButton("reload osc sender", loadFn );
}