当前位置: 首页>>代码示例>>C++>>正文


C++ createMenu函数代码示例

本文整理汇总了C++中createMenu函数的典型用法代码示例。如果您正苦于以下问题:C++ createMenu函数的具体用法?C++ createMenu怎么用?C++ createMenu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了createMenu函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char** argv) {
    
    int aux;	
    // inicialización del GLUT
    glutInit( &argc, argv );
    // inicialiación de la ventana
    glutInitWindowSize( 1020, 850 );  //Tamaño de la Ventana Creada
    glutInitWindowPosition( 100, 100 );
    glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
    glutCreateWindow( "Catastrofe Global - Fin del Sol" );
    glEnable(GL_SMOOTH);
    // inicialización de los datos del programa
    anos = 0;
    dia  = 0;
    hora = 0;
    min  = 0;
    explo= 0;
    mov  = 0;
    mov2 = 0.01;
    mov3 = 0;
    //derr = x; arr = y; z = z
    der  = -5;
    arr  = 5;
    z    = -35;
    //Variable para controlar el menú.
    value = 0;
    //Creamos el menú.
    createMenu();
    // registro de los eventos
    glutReshapeFunc (reshapeevent);
    glutDisplayFunc( displayevent );
    //Cambio de teclas por menú.
    glutSpecialFunc( specialkeyevent );
    //Controlamos no sólo las teclas especiales, las normales también 
    //(Para aumentar y reducir velocidad de rotación)
    //glutKeyboardFunc (Keyboard);
    glutIdleFunc( animacion );
    aux = carga_texturas();
    // lazo de eventos
    glutMainLoop();
    return 0;
}
开发者ID:albornozwladimir,项目名称:OpenGl---Fin-del-Sol,代码行数:42,代码来源:main.c

示例2: printf

bool Victory::init()
{
    // init the super
    if ( !LayerColor::initWithColor(Color4B(205, 203, 166, 120))) {
        
        return false;
    }
    
    Size parentVisibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();
    
    // this->setVisible(false);
    
    dialog = Sprite::create("Graphics/levelComplete.png");
    if (!dialog) {
        printf("Error opening levelComplete.png\n");
        return false;
    }
    
    Size rawSize = dialog->getBoundingBox().size;
    
    dialog->setAnchorPoint(Vec2(0,0));
    createMenu();
    
    dialog->setScale((rawSize.width/parentVisibleSize.width)*0.66);
    
    Size dialogSize = dialog->getBoundingBox().size;
    
    posX = (parentVisibleSize.width-dialogSize.width)/2.0;
    posY = (parentVisibleSize.height-dialogSize.height)/2.0;
    
    auto move = MoveTo::create(1.0, Vec2(posX, posY));
    auto bounceIn = EaseElasticOut::create(move->clone());
    dialog->setPosition(Vec2(posX, -dialogSize.height));
    
    
    // is there any way to fade this in nicely?
    // How do we scale to fit the phone size?
    this->addChild(dialog, 1);
    dialog->runAction(bounceIn);
    return true;
}
开发者ID:duongbadu,项目名称:GravityJam,代码行数:42,代码来源:GJ_Victory.cpp

示例3: srand

MainWindow::MainWindow()
{
  srand(time(NULL));

  setWindowTitle(trUtf8("Gomoku"));
  createMenu();

  statusBarLabel = new QLabel(this);
  scorePlayer1 = new QLabel(this);
  scorePlayer2 = new QLabel(this);

  statusBarLabel->setStyleSheet("font: 12pt;");
  scorePlayer1->setStyleSheet("font: 12pt;");
  scorePlayer2->setStyleSheet("font: 12pt;");

  statusBar()->addPermanentWidget(scorePlayer1, 90);
  statusBar()->addPermanentWidget(scorePlayer2, 200);
  statusBar()->addPermanentWidget(statusBarLabel);

  qApp->setStyleSheet("QStatusBar::item { border : 0px solid black }");

  grid = new Grid(19, this);
  grid->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));

  connect(grid, SIGNAL(gameStateChanged(Gomoku::GameState, uint8_t, uint8_t)),
          this, SLOT(applyGameState(Gomoku::GameState, uint8_t, uint8_t)));

  windowLayout = new QHBoxLayout();
  windowLayout->addWidget(grid);

  centralWidget = new QWidget();
  centralWidget->setLayout(windowLayout);

  setCentralWidget(centralWidget);

  resize(QSize(800, 800));

  gridDrawer = new GomokuGui();
  grid->setDisplay(gridDrawer);
  grid->repaint();
  newGame();
}
开发者ID:Shintouney,项目名称:MixedStuff,代码行数:42,代码来源:MainWindow.cpp

示例4: QMenu

void WBModelMenu::createMenu(const QModelIndex &parent, int max, QMenu *parentMenu, QMenu *menu)
{
    if (!menu)
    {
        QString title = parent.data().toString();
        menu = new QMenu(title, this);
        QIcon icon = qvariant_cast<QIcon>(parent.data(Qt::DecorationRole));
        menu->setIcon(icon);
        parentMenu->addMenu(menu);
        QVariant v;
        v.setValue(parent);
        menu->menuAction()->setData(v);
        connect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShow()));
        return;
    }

    int end = m_model->rowCount(parent);
    if (max != -1)
        end = qMin(max, end);

    connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(triggered(QAction*)));
    connect(menu, SIGNAL(hovered(QAction*)), this, SLOT(hovered(QAction*)));

    for (int i = 0; i < end; ++i)
    {
        QModelIndex idx = m_model->index(i, 0, parent);
        if (m_model->hasChildren(idx))
        {
            createMenu(idx, -1, menu);
        } 
        else
        {
            if (m_separatorRole != 0
                && idx.data(m_separatorRole).toBool())
                addSeparator();
            else
                menu->addAction(makeAction(idx));
        }
        if (menu == this && i == m_firstSeparator - 1)
            addSeparator();
    }
}
开发者ID:OpenBoard-org,项目名称:OpenBoard,代码行数:42,代码来源:WBModelMenu.cpp

示例5: nativeLoop

int nativeLoop(void) {
    HINSTANCE hInstance = GetModuleHandle(NULL);
    TCHAR* szWindowClass = TEXT("SystrayClass");
    MyRegisterClass(hInstance, szWindowClass);
    hWnd = InitInstance(hInstance, FALSE, szWindowClass); // Don't show window
    if (!hWnd) {
        return EXIT_FAILURE;
    }
    if (!createMenu() || !addNotifyIcon()) {
        return EXIT_FAILURE;
    }
    systray_ready(0);

    MSG msg;
    while (GetMessage(&msg, NULL, 0, 0)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return EXIT_SUCCESS;
}
开发者ID:alex2108,项目名称:systray,代码行数:20,代码来源:systray_windows.c

示例6: log

void TDDHelper::addTestButton(Node *parent, Point pos)
{
	if(HAS_TDD == false) {
		log("ERROR: TDD Framework is disable!");
		return;
	}
	
	
	if(parent == NULL) {
		log("ERROR: addTestButton: parent is NULL");		// or use Assert
		return;
	}
	
	Menu *menu = createMenu(pos, "Test!", [](Ref *sender) {
												TDDHelper::showTests();
											}
							);
	
	parent->addChild(menu);
}
开发者ID:tklee1975,项目名称:SDKTest,代码行数:20,代码来源:TDDHelper.cpp

示例7: QMainWindow

subMainWindow::subMainWindow(QWidget *parent) :
    QMainWindow(parent)
{
    createMenu();
    subImageLabel = new QLabel;
    subImageLabel->setBackgroundRole(QPalette::NoRole);
    subImageLabel->setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored);
    subImageLabel->setScaledContents(true); //选择自动适应框的变化,就是无论将对话框,缩小放大都不影响像素,作用在看图片的时候,图片的像素会跟着相框调整

    subScrollArea = new QScrollArea;       //滚动区域
    subScrollArea->setBackgroundRole(QPalette::Dark);
    subScrollArea->setWidget(subImageLabel);

    backImage = QImage();


    setCentralWidget(subScrollArea);
    setWindowTitle(tr("处理后的图片"));
    resize(600,500);
}
开发者ID:rio-2607,项目名称:image_process,代码行数:20,代码来源:submainwindow.cpp

示例8: main

int main(int argc, char **argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB);
    glutInitWindowSize(width, height);
    glutInitWindowPosition((glutGet(GLUT_SCREEN_WIDTH)-width)/2,
                       (glutGet(GLUT_SCREEN_HEIGHT)-height)/2);

    glutCreateWindow("Simple Paint And Draw Program");
    glutDisplayFunc(display);
    glutMouseFunc(mouse);
    glutKeyboardFunc(keyboard);
    glutReshapeFunc(reshape);
    createMenu();
    glClearColor(0.85f, 0.85f, 0.85f, 0.0f);
    glColor3f(0.0, 0.0, 0.0);
    glPointSize(5.0);
    glEnable(GL_MAP1_VERTEX_3);
    glutMainLoop();
}
开发者ID:gjiang3,项目名称:CS116A,代码行数:20,代码来源:simple_drawing.c

示例9: indexAt

void FSTableView::contextMenuEvent(QContextMenuEvent * event)
{
    QModelIndex index = indexAt(event->pos());
    QMenu * menu = 0;
    if (index.isValid())
    {
        if (selectionModel()->selectedRows().count() > 1)
            menu = createSelectionMenu();
        else
            menu = createItemMenu();

    }
    else
        menu = createMenu();

    menu->move(event->globalPos());
    menu->exec();
    delete menu;

}
开发者ID:Pileg8,项目名称:freebox-desktop,代码行数:20,代码来源:fstableview.cpp

示例10: createStarsBackground

// on "init" you need to initialize your instance
bool PizzaSpeedLevel::init()
{
    // 1. super init first
    if ( !Layer::init() )  return false;

    createStarsBackground("Pictures/bigStar.png",20);
    createStarsBackground("Pictures/smallStar.png",50);

    showInstructions();
    createMenu();
    addRemainingTimeLabel();
    addBackground("Pictures/PizzaSpeedBack.png");
    addSpaceShip("Pictures/PizzaSpeedShip.png");
    addTimeSlider();

    schedule( schedule_selector( PizzaSpeedLevel::update) );
    schedule( schedule_selector(PizzaSpeedLevel::updateRemainingTime));

    return true;
}
开发者ID:jcamposobando,项目名称:physica,代码行数:21,代码来源:PizzaSpeedLevel.cpp

示例11: QMenu

  TrayIcon::TrayIcon() {

    trayIconMenu = new QMenu( this );
    trayIcon = new QSystemTrayIcon( this );

    createMenu();

    trayIcon->setContextMenu( trayIconMenu );
    trayIcon->setIcon( QIcon( QString::fromUtf8( ":/dboxfe_image" ) ) );
    trayIcon->setToolTip( "DBoxFE - TrayIcon " + getAppVersion() );
    trayIcon->show();

    setWindowIcon( QIcon( QString::fromUtf8( ":/dboxfe_image" ) ) );
    setWindowTitle( getAppTitel() );

    update = new QTimer( this );
    connect( update, SIGNAL( timeout() ), this, SLOT( reloadMenu() ) );
    update->thread()->setPriority( QThread::NormalPriority );
    update->start( 15000 );
  }
开发者ID:BackupTheBerlios,项目名称:dboxfe-svn,代码行数:20,代码来源:tray.cpp

示例12: createWindow

/**
 * create window & run main loop
 */
void createWindow(windowData *win){
	FNAME();
	if(!initialized) return;
	if(!win) return;
	int w = win->w, h = win->h;
	DBG("create window with title %s", win->title);
	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
	glutInitWindowSize(w, h);
	win->GL_ID = glutCreateWindow(win->title);
	DBG("created GL_ID=%d", win->GL_ID);
	glutReshapeFunc(Resize);
	glutDisplayFunc(RedrawWindow);
	glutKeyboardFunc(keyPressed);
	glutSpecialFunc(keySpPressed);
	//glutMouseWheelFunc(mouseWheel);
	glutMouseFunc(mousePressed);
	glutMotionFunc(mouseMove);
	//glutIdleFunc(glutPostRedisplay);
	glutIdleFunc(NULL);
	DBG("init textures");
	glGenTextures(1, &(win->Tex));
	calc_win_props(win, NULL, NULL);
	win->zoom = 1. / win->Daspect;
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, win->Tex);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
//    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
   	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);

	glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
	//glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, win->image->w, win->image->h, 0,
			GL_RGB, GL_UNSIGNED_BYTE, win->image->rawdata);
	glDisable(GL_TEXTURE_2D);
	totWindows++;
	createMenu(win->GL_ID);
	DBG("OK, total opened windows: %d", totWindows);
}
开发者ID:eddyem,项目名称:eddys_snippets,代码行数:44,代码来源:imageview.c

示例13: QLabel

Keyswitch::Keyswitch(XKeyboard *keyboard, QWidget *parent) : QLabel(parent)
{
	keys=keyboard;
	QSettings * antico = new QSettings(QCoreApplication::applicationDirPath() + "/antico.cfg", QSettings::IniFormat, this);
	antico->beginGroup("Style");
	map_path = antico->value("path").toString()+"/language/";
	antico->endGroup(); //Style
	xkbConf = X11tools::loadXKBconf();
	if (xkbConf->status!=DONT_USE_XKB) {
		load_rules();
		qDebug()<<"XKB status : " <<xkbConf->status;
		if (xkbConf->status==USE_XKB)
			set_xkb();
		init();
		if (groupeName.count()>1 || xkbConf->showSingle) {
			draw_icon();
			createMenu();
		}
	}

}
开发者ID:sollidsnake,项目名称:qxkb,代码行数:21,代码来源:keyswitch.cpp

示例14: main

int main(int argc, char ** argv)
{
  
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);

  glutInitWindowSize(500,500); /*se voce deseja deixar em fullscreen comente essa linha
                                 e descomente a glutFullScreen(). Se quer só aumentar o
                                 tamanho inicial da janela, basta trocar os valores*/
  glutCreateWindow("EP 2 - Fractais");  
/*    glutFullScreen();   */

  init();
  createMenu();
  glutDisplayFunc(display);
  glutReshapeFunc(reshape);

  glutMainLoop(); /*O OpenGL passa a tomar controle total do programa*/
  
  return 0;
}
开发者ID:gorobaum,项目名称:gorobaumhome,代码行数:21,代码来源:EP2+-+FUNFANDO.c

示例15: clearObject

void Plane::create()
{
  clearObject();

  object_.header.frame_id = frame_id_;
  object_.name = name_;
  object_.description = name_ + " plane";
  object_.pose = pose_;

  mesh_.type = Marker::CUBE;
  mesh_.color = color_;
  mesh_.scale = scale_;
  mesh_.scale.z = 0.001;

  control_.always_visible = true;
  control_.interaction_mode = InteractiveMarkerControl::BUTTON;
  control_.markers.push_back(mesh_);
  object_.controls.push_back(control_);

  createMenu();
}
开发者ID:beds-tao,项目名称:srs_public,代码行数:21,代码来源:plane.cpp


注:本文中的createMenu函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。