コード例 #1
0
ファイル: main.cpp プロジェクト: willis7/minesweeper
int main(int argc,char **argv)
{
	
	initRandNum("scripts/mines.lua");										//call for Lua to do the random number generator
	int *pScreen;
	pScreen = configScreen();											//pScreen now becomes the array returned by configScreen

	player one;															//creates a player struct
	configPlayer(one);													//fills player struct
	startX = one.StartPosX;												//takes variables from player struct for OpenGL to use
	startY = one.StartPosY;
 
	int number;
	cout << "\nHow many mines do you want in the game  " << endl;
	cin >> number;

	mineGenerator(number);												//Calls function to randomly generate mines

	initOpenAL();
    alGetError();
    if (loadALData() == AL_FALSE)
        return 0;
    setListenerValues();
    atexit(killALData);
    alSourcePlay(Sources[LOOP]);

	glutInit(&argc,argv);												
	glutInitWindowPosition(100,100);
	glutInitWindowSize(pScreen[0],pScreen[1]);						
	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);

	init();	
	win = glutCreateWindow("Mine Sweeper");
	createMenu();

	glutDisplayFunc(drawScene);
	glutKeyboardFunc(handleKeypress);
	glutIdleFunc(handleIdle);
	glutSpecialFunc(handleSpecialKeys);								

	glOrtho(-1,16,-1,16,0,-1);
	//gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);

	
	glutMainLoop();

	
}
コード例 #2
0
ファイル: MainWindow.cpp プロジェクト: habib256/qtpom1
void MainWindow::createActions()
{
    loadMemoryAction = new QAction(tr("&Load Memory from disk"),this);
    loadMemoryAction->setIcon(QIcon(":/images/loadMemory.png"));
    connect(loadMemoryAction, SIGNAL(triggered()), this, SLOT(loadMemory()));
    saveMemoryAction = new QAction(tr("&Save Memory to disk"),this);
    saveMemoryAction->setIcon(QIcon(":/images/saveMemory.png"));
    connect(saveMemoryAction, SIGNAL(triggered()), this, SLOT(saveMemory()));
    pasteCodeAction = new QAction(tr("&Paste Code"),this);
    pasteCodeAction->setIcon(QIcon(":/images/pasteCode.png"));
    connect(pasteCodeAction, SIGNAL(triggered()), this, SLOT(pasteCode()));
    quitAction = new QAction(tr("&Quit QtPom1"),this);
    quitAction->setIcon(QIcon(":/images/quit.png"));
    //quitAction->setIcon(QIcon(":/images/quit.png"));
    connect(quitAction, SIGNAL(triggered()), this, SLOT(quit()));

    resetAction = new QAction(tr("Soft &Reset"),this);
    resetAction->setIcon(QIcon(":/images/reset.png"));
    connect(resetAction, SIGNAL(triggered()), this, SLOT(reset()));
    hardResetAction = new QAction(tr("&Hard Reset"),this);
    hardResetAction->setIcon(QIcon(":/images/hardreset.png"));
    connect(hardResetAction, SIGNAL(triggered()), this, SLOT(hardReset()));
    debugCpuAction = new QAction(tr("&Debug Console"),this);
    debugCpuAction->setIcon(QIcon(":/images/debug.png"));
    connect(debugCpuAction, SIGNAL(triggered()), this, SLOT(debugCpu()));

    configScreenAction = new QAction(tr("&Screen Options"),this);
    configScreenAction->setIcon(QIcon(":/images/screen.png"));
    connect(configScreenAction, SIGNAL(triggered()), this, SLOT(configScreen()));
    configMemoryAction = new QAction(tr("&Memory Options"),this);
    configMemoryAction->setIcon(QIcon(":/images/memory.png"));
    connect(configMemoryAction, SIGNAL(triggered()), this, SLOT(configMemory()));

    aboutAction = new QAction(tr("&About QtPom1"),this);
    aboutAction->setIcon(QIcon(":/images/about.png"));
    connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
    aboutQtAction = new QAction(tr("About &Qt"),this);
    aboutQtAction->setIcon(QIcon(":/images/aboutQt.png"));
    connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
}