本文整理汇总了C++中MyWindow类的典型用法代码示例。如果您正苦于以下问题:C++ MyWindow类的具体用法?C++ MyWindow怎么用?C++ MyWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MyWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
// load a skeleton file
// create and initialize the world
dart::simulation::World* myWorld
= dart::utils::SkelParser::readWorld(
DART_DATA_PATH"skel/soft_open_chain.skel");
assert(myWorld != NULL);
int dof = myWorld->getSkeleton("skeleton 1")->getNumGenCoords();
Eigen::VectorXd initPose = Eigen::VectorXd::Zero(dof);
for (int i = 0; i < 3; i++)
initPose[i] = dart::math::random(-0.5, 0.5);
myWorld->getSkeleton("skeleton 1")->setConfigs(initPose, true, true, false);
// create a window and link it to the world
MyWindow window;
window.setWorld(myWorld);
std::cout << "space bar: simulation on/off" << std::endl;
std::cout << "'p': playback/stop" << std::endl;
std::cout << "'[' and ']': play one frame backward and forward" << std::endl;
std::cout << "'v': visualization on/off" << std::endl;
std::cout << "'1'--'4': programmed interaction" << std::endl;
glutInit(&argc, argv);
window.initWindow(640, 480, "Soft Open Chain");
glutMainLoop();
return 0;
}
示例2: main
int main(int argc, char* argv[])
{
// load a skeleton file
FileInfoSkel<SkeletonDynamics> model;
model.loadFile(DART_DATA_PATH"/skel/Chain.skel", SKEL);
// create and initialize the world
World *myWorld = new World();
Vector3d gravity(0.0, -9.81, 0.0);
myWorld->setGravity(gravity);
myWorld->setTimeStep(1.0/2000);
myWorld->addSkeleton((SkeletonDynamics*)model.getSkel());
int nDof = myWorld->getSkeleton(0)->getNumDofs();
VectorXd initPose(nDof);
for (int i = 0; i < nDof; i++)
initPose[i] = random(-0.5, 0.5);
myWorld->getSkeleton(0)->setPose(initPose);
// create a window and link it to the world
MyWindow window;
window.setWorld(myWorld);
glutInit(&argc, argv);
window.initWindow(640, 480, "Forward Simulation");
glutMainLoop();
return 0;
}
示例3: sample_main
/////////////////////////////////////////////////////////////////////////
// Main initialization point
//
int sample_main(int argc, const char** argv)
{
NVPWindow::ContextFlags context(
3, //major;
3, //minor;
false, //core;
1, //MSAA;
true, //debug;
false, //robust;
false, //forward;
NULL //share;
);
g_myWindow.argc = argc;
g_myWindow.argv = argv;
if(!g_myWindow.create("bk3d viewer", &context))
return false;
g_myWindow.makeContextCurrent();
g_myWindow.swapInterval(0);
while(MyWindow::sysPollEvents(false) )
{
idle();
}
return true;
}
示例4: main
int main(int argc, char* argv[]) {
// create and initialize the world
dart::simulation::World *myWorld
= dart::utils::SkelParser::readWorld(
DART_DATA_PATH"/skel/bullet_collision.skel");
assert(myWorld != NULL);
Eigen::Vector3d gravity(0.0, -9.81, 0.0);
myWorld->setGravity(gravity);
// create a window and link it to the world
MyWindow window;
window.setWorld(myWorld);
std::cout << "space bar: simulation on/off" << std::endl;
std::cout << "'p': playback/stop" << std::endl;
std::cout << "'[' and ']': play one frame backward and forward" << std::endl;
std::cout << "'v': visualization on/off" << std::endl;
std::cout << "'1'--'4': programmed interaction" << std::endl;
std::cout << "'q': spawn a random cube" << std::endl;
std::cout << "'w': delete a spawned cube" << std::endl;
glutInit(&argc, argv);
window.initWindow(640, 480, "Bullet Collision");
glutMainLoop();
return 0;
}
示例5: main
int main()
{
MyWindow w;
w.create(); // 이 순간 윈도우가 만들어져야 합니다.
// 왼쪽 버튼을 누르면 "LButton" 이라고 출력되어야 합니다.
IoProcessMessage();
}
示例6: createWindow
//-----------------------------------------------------------------------------
MyWindow* createWindow( int width, int height )
//-----------------------------------------------------------------------------
{
MyWindow* pWindow = new MyWindow( width, height );
if( pWindow->can_do() == 0 )
{
cout << "OpenGL not possible!!" << endl;
}
else
{
cout << "Using OpenGL." << endl;
if( pWindow->can_do_overlay() == 0 )
{
cout << "OpenGL Overlays not possible!!" << endl;
}
else
{
cout << "Using OpenGL Overlays." << endl;
}
//window->clear_border();
gl_font( FL_TIMES, 12 );
Fl::gl_visual( FL_RGB );
pWindow->end();
pWindow->show();
}
return pWindow;
}
示例7: main
int main()
{
MyWindow w;
w.Create(); // 이 순간 윈도우가 생성되어야 합니다.
// LBUTTON누르면 "LButton" 출력 되어야 합니다.
IoProcessMessage(); // 종료하지 말고 메시지를 처리해달라.
}
示例8: main
int main(int argc, char* argv[])
{
// load a skeleton file
// create and initialize the world
dart::simulation::SoftWorld *myWorld
= dart::utils::SoftSkelParser::readSoftFile(
DART_DATA_PATH"skel/test/test_single_pendulum.skel");
assert(myWorld != NULL);
// create a window and link it to the world
MyWindow window;
window.setWorld(myWorld);
std::cout << "space bar: simulation on/off" << std::endl;
std::cout << "'p': playback/stop" << std::endl;
std::cout << "'[' and ']': play one frame backward and forward" << std::endl;
std::cout << "'v': visualization on/off" << std::endl;
std::cout << "'1'--'4': programmed interaction" << std::endl;
glutInit(&argc, argv);
window.initWindow(640, 480, "Soft Single Pendulum");
glutMainLoop();
return 0;
}
示例9: main
int main(int argc, char* argv[])
{
// load a skeleton file
// create and initialize the world
dart::simulation::World* myWorld
= dart::utils::readSkelFile(DART_DATA_PATH"/skel/chain.skel");
assert(myWorld != NULL);
// create and initialize the world
Eigen::Vector3d gravity(0.0, -9.81, 0.0);
myWorld->setGravity(gravity);
myWorld->setTimeStep(1.0/2000);
int dof = myWorld->getSkeleton(0)->getDOF();
Eigen::VectorXd initPose(dof);
for (int i = 0; i < dof; i++)
initPose[i] = random(-0.5, 0.5);
myWorld->getSkeleton(0)->setPose(initPose);
// create a window and link it to the world
MyWindow window;
window.setWorld(myWorld);
glutInit(&argc, argv);
window.initWindow(640, 480, "Forward Simulation");
glutMainLoop();
return 0;
}
示例10: main
int main(int argc, char** argv) {
CrazyContainer *container = new CrazyContainer();
container->loadXML();
MyWindow *window = new MyWindow();
window->setCrazyContainer(container);
Fl_Button *b1 = new Fl_Button(20, 20, 80, 25, "Connect");
b1->callback(connect,(void *)container);
Fl_Button *b2 = new Fl_Button(100, 20, 80, 25, "Go 11000");
b2->callback(run,(void *)container);
FLContainer::thrustOutput = new Fl_Value_Slider(100,50,250,25,"Thrust meter");
FLContainer::thrustOutput->type(FL_HOR_FILL_SLIDER);
FLContainer::thrustOutput->scrollvalue(5000, 100, 5000, 100000);
FLContainer::thrustOutput->callback(runCustomThrust,(void *)container);
FLContainer::pitch = new Fl_Value_Slider(100,100,250,25,"Pitch");
FLContainer::pitch->type(FL_HORIZONTAL);
FLContainer::pitch->scrollvalue(0,10,-180,370);
FLContainer::pitch->precision(2);
FLContainer::roll = new Fl_Value_Slider(100,140,250,25,"Roll");
FLContainer::roll->type(FL_HORIZONTAL);
FLContainer::roll->scrollvalue(0,10,-180,370);
FLContainer::roll->precision(2);
FLContainer::yaw = new Fl_Value_Slider(100,180,250,25,"Yaw");
FLContainer::yaw->type(FL_HORIZONTAL);
FLContainer::yaw->scrollvalue(0,10,-180,370);
FLContainer::yaw->precision(2);
FLContainer::offsetPitch = new Fl_Value_Slider(100,220,250,25,"Offset Pitch");
FLContainer::offsetPitch->type(FL_HORIZONTAL);
FLContainer::offsetPitch->scrollvalue(container->getOffsetPitch(),10,-20,50);
FLContainer::offsetPitch->precision(2);
FLContainer::offsetPitch->callback(setOffsetPitch,(void *)container);
FLContainer::offsetRoll = new Fl_Value_Slider(100,260,250,25,"Offset Roll");
FLContainer::offsetRoll->type(FL_HORIZONTAL);
FLContainer::offsetRoll->scrollvalue(container->getOffsetRoll(),10,-20,50);
FLContainer::offsetRoll->precision(2);
FLContainer::offsetRoll->callback(setOffsetRoll,(void *)container);
Fl_Button *b3 = new Fl_Button(200, 20, 80, 25, "Stop");
b3->callback(stop,(void *)container);
Fl_Button *bfocus = new Fl_Button(20, 45, 80, 25, "Focus");
Fl_Button *b5 = new Fl_Button(400, 20, 80, 25, "Kill n' Exit");
b5->callback(killnstop,(void *)container);
Fl_Button *bsave = new Fl_Button(500, 20, 80, 25, "Plot");
bsave->callback(save,(void *)container);
Fl_Button *bload = new Fl_Button(500, 50, 80, 25, "Load");
bload->callback(load,(void *)container);
window->end();
window->show(argc,argv);
return Fl::run();
}
示例11: main
/////////////////////////////////////////////////////////////
// Main: initialize X, create an instance of MyWindow class,
// and start the message loop
int main() {
// Initialize X stuff
if (!GWindow::initX()) {
printf("Could not connect to X-server.\n");
exit(1);
}
MyWindow w;
w.createWindow(
I2Rectangle( // Window frame rectangle:
I2Point(10, 10), // left-top corner
GWindow::screenMaxX()/2, // width
GWindow::screenMaxY()/2 // height
),
R2Rectangle( // Coordinate rectangle:
R2Point(-12., -9.), // bottom-right corner
24., 18. // width, height
),
"Graph of Function" // Window title
);
w.setBackground("lightGray");
GWindow::messageLoop();
GWindow::closeX();
return 0;
}
示例12: main
int main(){
MyWindow win;
GLVDetachable gui;
glv::Table layout("><");
// Create some random widgets for testing
glv::Button btn;
glv::Sliders sld(glv::Rect(100,10*4), 1,4);
glv::Slider2D sld2;
btn.colors().set(glv::Color(1,0,0));
layout.enable(glv::DrawBack);
//layout.enable(glv::Controllable | glv::HitTest);
//layout.addHandler(glv::Event::MouseDrag, glv::Behavior::mouseMove);
layout
<< gui.detachedButton() << new glv::Label("detach")
<< btn << new glv::Label("param 1")
<< sld << new glv::Label("param 2")
<< sld2<< new glv::Label("param 3")
;
gui << layout;
layout.arrange();
// We must assign a parent window to the GUI
gui.parentWindow(win);
win.append(*new StandardWindowKeyControls);
win.create();
MainLoop::start();
}
示例13: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MyWindow window;
window.showMaximized();
QThread thread;
Detector *detector = new Detector();
detector->moveToThread(&thread);
detector->connect(&thread,SIGNAL(started()),SLOT(work()));
QThread thread2;
MyBluetooth *bt = new MyBluetooth();
bt->moveToThread(&thread2);
bt->connect(&thread2,SIGNAL(started()),SLOT(scanList()));
bt->connect(&window,SIGNAL(updateScan()),SLOT(scanList()));
bt->connect(detector,SIGNAL(detected()),SLOT(checkAlert()));
//typedef std::list<Phone> listPhone;
qRegisterMetaType<std::list<Phone*> >("List<Phone>");
window.connect(bt,SIGNAL(finishedScan(std::list<Phone*>)),SLOT(setList(std::list<Phone*>)));
window.connect(bt,SIGNAL(finishedCheck(std::list<Phone*>)),SLOT(checkAlert(std::list<Phone*>)));
thread.start();
thread2.start();
return a.exec();
}
示例14: main
int main(int argc, char **argv) {
SDL_Event e;
MyWindow* window = new MyWindow("Handle Key Press Event", 800, 600);
window->updateSurface(bmpDefault->getSurface());
while (window->isRunning()) {
while (SDL_PollEvent(&e)) {
switch (e.type)
{
case SDL_QUIT:
window->setRunning(false);
break;
case SDL_KEYDOWN:
handleKeyDownEvent(e, window);
break;
default:
break;
}
}
}
closeSDL(window->getWindow());
return 0;
}
示例15: utIOWindowGL
int utIOWindowGL(){
MyWindow win;
MyWindow win2;
// struct Func:TimedFunction{
// void onExecute(){ printf("hello\n"); }
// };
//
// Func tf;
// tf(1000);
win.create(Window::Dim(100,0, 200,200), "Window 1", 40);
win2.create(Window::Dim(300,0, 200,200), "Window 2", 40);
// win2.create(Window::Dim(200,200,300), "Window 2", 40, SingleBuf);
win.freqs(1,2);
win2.freqs(3,4);
//win.cursorHide(true);
Window::startLoop();
return 0;
}