Beispiel #1
0
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: loadUrlAddr(); break;
        case 1: displayUrlAddr((*reinterpret_cast< const QUrl(*)>(_a[1]))); break;
        case 2: showTitle((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 3: toolBarMovable((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 4: webLoadStarted(); break;
        case 5: webLoadFinished((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 6: webLoadProgress((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 7: myOnLinkClicked((*reinterpret_cast< const QUrl(*)>(_a[1]))); break;
        case 8: myContentChanged(); break;
        case 9: on_pbExit_clicked(); break;
        case 10: on_pbInput_clicked(); break;
        case 11: on_dockwidget_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 12;
    }
    return _id;
}
ccShiftAndScaleCloudDlg::ccShiftAndScaleCloudDlg(	const CCVector3d& Pl,
													double Dl,
													const CCVector3d& Pg,
													double Dg,
													QWidget* parent/*=0*/)
	: QDialog(parent)
	, m_ui(0)
	, m_applyAll(false)
	, m_cancel(false)
	, m_activeInfoIndex(-1)
	, m_originalPoint(Pg)
	, m_originalDiagonal(Dg)
	, m_localPoint(Pl)
	, m_localDiagonal(Dl)
	, m_reversedMode(true)
{
	init();

	showWarning(false);
	showTitle(false);
	showKeepGlobalPosCheckbox(true);
	showScaleItems(m_originalDiagonal > 0.0 && m_localDiagonal > 0.0);
	showCancelButton(true);

	//to update the GUI accordingly
	onGlobalPosCheckBoxToggled(m_ui->keepGlobalPosCheckBox->isChecked());
}
Beispiel #3
0
void main() {
	init();

	while(1) {
		showTitle();
		gameLoop();
	}
}
Beispiel #4
0
void Game::loop()
{
	sf::Event ourEvent;
	_window.GetEvent( ourEvent );

	switch( _gameState )
	{
		// TODO: Implement LOADING, PAUSE_MENU, LEVELING(?), DEATH(?) cases
		case TITLE_SCREEN:
		{
			showTitle();
			_gameState = WORLD_MAP;
			break;
		}

		case MAIN_MENU:
		{
			break;
		}

		case WORLD_MAP:
		{
			// background color is the grass color for now
			_window.Clear( sf::Color( 31, 186, 67 ) );

			if( ourEvent.Type == sf::Event::Closed )
				_gameState = EXITING;

			if( ourEvent.Type == sf::Event::KeyPressed )
			{
				if( ourEvent.Key.Code == sf::Key::Escape )
					_gameState = EXITING;

				if( ourEvent.Key.Code == sf::Key::B )
					_gameState = BATTLE_SCREEN;
			}

			BackgroundObjectManager::updateObjects();
			// update the foreground objects after, or else the background sprites will be drawn on top of the foreground stuffs (e.g. player sprite )
			VisibleObjectManager::updateObjects();

			BackgroundObjectManager::displayObjects( _window );
			VisibleObjectManager::displayObjects( _window );

			_window.Display();

			break;
		}

		case BATTLE_SCREEN:
		{
			showBattle();
			_gameState = WORLD_MAP; // should be LEVELING or DEATH based on outcome of battle later on
			break;
		}
	}
}
Beispiel #5
0
void handlePageChange(void)
{
    // Some OLED displays do not respond on the first initialisation so refresh the display
    // when the page changes in the hopes the hardware responds.  This also allows the
    // user to power off/on the display or connect it while powered.
    resetDisplay();

    i2c_OLED_clear_display_quick();
    showTitle();
}
void TitleTemplateDlg::OnBnClickedTitlesetPretitle()
{
	// TODO: 在此添加控件通知处理程序代码
	if ( m_curTitle > 0 )
	{
		-- m_curTitle ; 
		m_changeTitle = true; 
		showTitle(); 
	}
}
void TitleTemplateDlg::OnBnClickedTitlesetNexttitle()
{
	// TODO: 在此添加控件通知处理程序代码
	// 标题模板非空 且 非最后一项
	if ( m_titleNum &&  m_curTitle  < (m_titleNum - 1) )
	{
		m_curTitle ++; 
		m_changeTitle = true; 
		showTitle (); 
	}
}
void TitleTemplateDlg::OnBnClickedTitlesetFirsttitle()
{
	// TODO: 在此添加控件通知处理程序代码
	// 没有标题模板什么也不做
	if ( m_titleNum == 0 )
		return ; 

	m_curTitle = 0; 
	m_changeTitle = true; 
	showTitle(); 
}
void TitleTemplateDlg::OnBnClickedTitlesetTitlecontent()
{
	// TODO: 在此添加控件通知处理程序代码
	if ( m_curTitle == -1 )
	{
		MessageBoxW ( _T("please insert title firstly.")); 
		return ; 
	}
	// 
	
	m_titleTemplate[m_curTitle] += _T("[标题内容]");
	showTitle(); 
}
void TitleTemplateDlg::OnBnClickedTitlesetCleartitle()
{
	// TODO: 在此添加控件通知处理程序代码
	// 没有title模板 或现在不在任何标题上
	if ( ! m_titleNum || m_curTitle == -1  )
		return ; 
	if ( m_curTitle < m_titleNum  )
	{
		m_titleTemplate[m_curTitle] = _T(""); 
		m_changeTitle = true; 
		showTitle(); 
	}
	
}
void TitleTemplateDlg::OnBnClickedTitlesetSpace()
{
	// TODO: 在此添加控件通知处理程序代码
	if ( m_curTitle == -1 )
	{
		MessageBoxW ( _T("please insert title firstly.")); 
		return ; 
	}
	// 
	CString *title =  &  m_titleTemplate[m_curTitle]; 
	if ( title->Right( _tcsclen( _T("[ \\t]+"))) != _T("[ \\t]+") )
		*title += _T("[ \\t]+"); 
	
	showTitle(); 
}
BOOL TitleTemplateDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// TODO:  在此添加额外的初始化
	// 开始提供第一标题
	m_titleTemplatePre = m_titleTemplate; 
	m_titleNumPre = m_titleNum; 

	m_curTitle = 0; 
	m_changeTitle = true;
	showTitle(); 
	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
void TitleTemplateDlg::OnBnClickedTitlesetBigalpha()
{
	// TODO: 在此添加控件通知处理程序代码
	// m_curTitle 是 m_titleTemplate 的有效下标,函数外得到确保。
	if ( m_curTitle == -1 )
	{
		
		MessageBoxW ( _T("please insert title firstly .")); 
		return ; 
	}
	// 
	CString *title =  &  m_titleTemplate[m_curTitle]; 
	if ( title->Right( _tcsclen( _T("[A-Z]+"))) != _T("[A-Z]+") )
		*title += _T("[A-Z]+"); 
	showTitle(); 
}
void TitleTemplateDlg::OnBnClickedTitlesetCanceltitle()
{
	// TODO: 在此添加控件通知处理程序代码
	if ( m_titleNum == 0 )
	{
		return ; 
	}
	for ( int i=m_curTitle; i<m_titleNum-1; i++ )
		m_titleTemplate[i] = m_titleTemplate[i+1]; 
	m_titleTemplate[m_titleNum-1] = _T(""); 
	// 删除的是最后一个
	if ( m_curTitle == m_titleNum-1 )
		m_curTitle -= 1; 
	m_titleNum --; 
	m_changeTitle = true; 
	showTitle (); 
}
Beispiel #15
0
void Game::run() {
	if (!showLicenseSplash())
		return;
	if (!showTitle())
		return;
	if (!showMainMenu())
		return;
	if (!showQuote())
		return;
	if (!showChapter1())
		return;

	_module.reset(new Module(*_console));

	runModule();

	_module.reset();
}
void TitleTemplateDlg::OnBnClickedTitlesetInserttitle()
{
	// TODO: 在此添加控件通知处理程序代码
	// 如果vector空间不够 插入
	if ( m_titleNum >= m_titleTemplate.size() )
	{
	      m_titleTemplate.push_back ( CString(_T(""))); 
	}
	for ( int i=m_titleNum-1;  i > m_curTitle ; i-- )
	{
		m_titleTemplate[i+1] = m_titleTemplate[i]; 
	}
	m_curTitle ++; 
	m_titleTemplate[m_curTitle] = _T(""); 
	m_titleNum ++; 
	// 插入后 显示最新的title
	m_changeTitle = true; 
	showTitle (); 
}
Beispiel #17
0
void Game::run() {
	if (!showLicenseSplash())
		return;
	if (!showTitle())
		return;
	if (!showMainMenu())
		return;
	if (!showQuote())
		return;
	if (!showChapter1())
		return;

	_module = new Module(*_console);

	runModule();

	delete _module;
	_module = 0;
}
Beispiel #18
0
void CGEEngine::cge_main() {
	memset(_barriers, 0xFF, sizeof(_barriers));

	if (!_mouse->_exist)
		error("%s", _text->getText(kTextNoMouse));

	if (!_resman->exist(kSavegame0Name))
		_mode = 2;

	_debugLine->_flags._hide = true;
	if (_horzLine)
		_horzLine->_flags._hide = true;

	if (_music && _soundOk)
		_midiPlayer->loadMidi(0);

	if (_startGameSlot != -1) {
		// Starting up a savegame from the launcher
		_mode++;
		runGame();

		_startupMode = 2;
		if (_flag[3]) // Flag FINIS
			movie(kEndgExt);
	} else {
		if (_mode < 2)
			movie(kLgoExt);

		if (showTitle("WELCOME")) {
			if (_mode == 1)
				movie(kIntroExt);
			runGame();
			_startupMode = 2;
			if (_flag[3]) // Flag FINIS
				movie(kEndgExt);
		} else
			_vga->sunset();
	}
}
void TitleTemplateDlg::OnBnClickedTitlesetInseretbutton()
{
	// TODO: 在此添加控件通知处理程序代码
	if ( m_curTitle == -1 )
	{
		MessageBoxW ( _T("please insert title firstly.")); 
		return ; 
	}
	

	CWnd *pWnd = this->GetDlgItem( IDC_TITLESET_INSERTCHAR ); 
	CString editText, nonEscape; 
	
	pWnd->GetWindowTextW(  editText ); 
	UINT pos = 0; 
	CString *title =  &  m_titleTemplate[m_curTitle]; 
	while ( pos < editText.GetLength() )
	{
		TCHAR textChar = editText.GetAt(pos ++); 
		switch ( textChar ) 
		{
		case _T('['):
		case _T('\\'):
		case _T('.'):
		case _T('+'):
		case _T('*'):
		case _T(']'):
			*title += _T('\\'); 
			*title +=  textChar ;
			break; 
		default:
			*title +=  textChar; 

		}
	}
	
	showTitle(); 
}
Beispiel #20
0
int main()
{
	
	srand ( time(NULL) );
	
	game_graphics = new SDLGraphics(SCREEN_WIDTH + 150, SCREEN_HEIGHT, "Min Wage", 0,0,0);
	//game_timer = new Timer();
	
	game_input = new Input();

	gameMenu = new menuClass();
	gameIndoors = new IndoorHandler();
	
	playerStuff.gameStart();
	
	//There's got to be a better way to do this (generating random tiles for the grass)...
	//This is probably a better idea: generate the entire backdrop as an SDL_Surface that can be drawn 
	//														each time it is needed?

	int randTiles[(SCREEN_HEIGHT / 32) * (SCREEN_WIDTH / 32)];
	int i = 0;
	for (i = 0; i < (SCREEN_HEIGHT / 32) * (SCREEN_WIDTH / 32); i++)
	{
		randTiles[i] = rand() % 4;
	}

	//makeMap();
	//loadMapFile("datfile.dat");
	setupTiles();

	showTitle();

	gameloop(randTiles);

	exitGame();

	return 0;
}
Beispiel #21
0
void handlePageChange(void)
{
    i2c_OLED_clear_display_quick();
    showTitle();
}
Beispiel #22
0
void dashboardUpdate(timeUs_t currentTimeUs)
{
    static uint8_t previousArmedState = 0;
    bool pageChanging;

#ifdef CMS
    static bool wasGrabbed = false;
    if (displayIsGrabbed(displayPort)) {
        wasGrabbed = true;
        return;
    } else if (wasGrabbed) {
        pageChanging = true;
        wasGrabbed = false;
    } else {
        pageChanging = false;
    }
#else
    pageChanging = false;
#endif

    bool updateNow = (int32_t)(currentTimeUs - nextDisplayUpdateAt) >= 0L;

    if (!updateNow) {
        return;
    }

    nextDisplayUpdateAt = currentTimeUs + DASHBOARD_UPDATE_FREQUENCY;

    bool armedState = ARMING_FLAG(ARMED) ? true : false;
    bool armedStateChanged = armedState != previousArmedState;
    previousArmedState = armedState;

    if (armedState) {
        if (!armedStateChanged) {
            return;
        }
        currentPageId = PAGE_ARMED;
        pageChanging = true;
    } else {
        if (armedStateChanged) {
            currentPageId = PAGE_STATUS;
            pageChanging = true;
        }

        if ((currentPageId == PAGE_WELCOME) && ((int32_t)(currentTimeUs - nextPageAt) >= 0L)) {
            currentPageId = PAGE_STATUS;
            pageChanging = true;
        }

        if (forcePageChange) {
            pageChanging = true;
            forcePageChange = false;
        }
    }

    if (pageChanging) {
        // Some OLED displays do not respond on the first initialisation so refresh the display
        // when the page changes in the hopes the hardware responds.  This also allows the
        // user to power off/on the display or connect it while powered.
        if (!displayPresent) {
            resetDisplay();
        }

        if (!displayPresent) {
            return;
        }

        i2c_OLED_clear_display_quick();
        showTitle();
    }

    if (!displayPresent) {
        return;
    }

    switch(currentPageId) {
        case PAGE_WELCOME:
            showWelcomePage();
            break;
        case PAGE_ARMED:
            showArmedPage();
            break;
        case PAGE_STATUS:
            showStatusPage();
            break;
    }

    if (!armedState) {
        updateFailsafeStatus();
        updateRxStatus();
        updateTicker();
    }
}
Beispiel #23
0
/*notice the default arguments for main.  SDL expects main to look like that, so don't change it*/
int main(int argc, char *argv[])
{

 // SDL_Surface *temp = NULL;

  
  int done;// the player
  const Uint8 *keys;// the player

  /* This section starts by loading the BG as a surface and converting it to a texture This will have to change 
  if I can manage to scroll the trexture arond the player*/
 
SDL_CreateWindowAndRenderer(800, 600, SDL_WINDOW_RESIZABLE, &mainWindow, &renderer);
SDL_SetWindowTitle(mainWindow, "Nitro Hotness");
 if( TTF_Init() == -1 )
    {
        return false;    
    }

  if( Mix_OpenAudio( 22050, MIX_DEFAULT_FORMAT, 2, 4096 ) == -1 )
    {
        return false;    
    }

InitSpriteSystem();
InitEntitySystem(entityMax);


map mymap = setWorld();
ObstacleList ol = newObstacleList();
mew = newPlayer();
Obstacle Doh = newObstacle(0);
Road_M Path = initRoad();
AI rival = new_AI();
GUI HUD = InitGUI();
mew.position=0;
done = 0;

//The music that will be played
   Mix_Music *music = NULL;


   Mix_Chunk *buzz = NULL;
    buzz = Mix_LoadWAV( "sfx/buzz.wav" );
	readSave(&mew);
	showTitle();
	showMain();
  oldTime = 0;
  currentTime = 0;
  mytime = 0;

do
 	{
		
  oldTime = 0;
  currentTime = 0;
  mytime = 0;
	  if( Mix_PlayingMusic() == 0 )
                    {
                        //Play the music
                        if( Mix_PlayMusic( level_music, -1 ) == -1 )
                        {
                            return 1;
                        } 
					}
	 SDL_Event e;
	 SDL_PollEvent( &e ); 
		if(&e)
					{
					//User requests quit
					if( e.type == SDL_QUIT )
					{
						done = 1;
					}
					//user presses enter to go to next menu
					
					//User presses a key
					else if( e.type == SDL_KEYDOWN )
					{
						//Select surfaces based on key press
						switch( e.key.keysym.sym )
						{
						
						case SDLK_LEFT:
				//		slog("left is down");	
						mew.playerX += 3;
						mew.accel = (mew.accel - .000001);
						break;

						case SDLK_RIGHT:
					//	slog("right is down");
						mew.playerX -= 3;
						mew.accel = (mew.accel - .000001);
						break;

						case SDLK_UP:
					//	slog("up is down");
						 mew.accel = (mew.accel + .00007);
						 Mix_PlayChannel( 1, buzz, 0 );
						 break;
						
						case SDLK_DOWN:
					//	slog("down is down");
						mew.accel = (mew.accel - .00008);
						break;
						}
					}

					else if( e.type == SDL_KEYUP )
					{
						//Select surfaces based on key press
						switch( e.key.keysym.sym )
						{	
						
						case SDLK_RETURN :
						if(mew.done ==1)
						{
							Mix_HaltMusic();
							if(GP == 1)
							{
							mew.done=0;
							lvl++;
							//slog("new level is %i",lvl);
							mew.position = 0;
							rival.position =0;
							setWorld();
							Results(mew.rank,lvl);
							}
						else if (GP == 0)
							{
							mew.done=0;
							mew.position = 0;
							rival.position =0;
							levelSelect();
							}
						
						}
						else
						{
						slog("too soon");
						}
						
						case SDLK_LEFT:
					//	slog("left is up");	
						e.type = SDLK_CLEAR;
						break;

						case SDLK_RIGHT:
					//	slog("right is up");
						e.type = SDLK_CLEAR;
						break;

						case SDLK_UP:
					//	slog("up is up");
						mew.accel = (mew.accel - .001);
						Mix_HaltChannel(1);
						e.type = SDLK_CLEAR;
						break;

						case SDLK_DOWN:
					//	slog("down is up");
						mew.accel = 0;
						e.type = SDLK_CLEAR;
						break;

						default:
					//slog("simple decel");	
						mew.accel = (mew.accel-0.00001);
						break;

						}
					}

		if(mew.position > rival.position)
		{
			mew.rank = 1 ;
		}
		else if( rival.position > mew.position )
		{
			mew.rank = 2 ;
		}
		SDL_RenderClear(renderer);
		DrawBG(BG1,BG2);
		roadUpdate(Path,mymap,mew);
		roadDraw(Path,mymap,&mew);
		roadFetch(Path,mymap,&mew);
		checkForObstacles(ol , &mew, Doh);
		update_AI(&rival, &mew);
		UpdatePlayer(&mew);
		DrawGui(HUD,mew);
		NextFrame();
		keys = SDL_GetKeyboardState(NULL);

	if(keys[SDL_SCANCODE_ESCAPE])
    {
        done = 1;
    }
	
}
  }while(!done);
      //Free the sound effects
   //Free the music
  Mix_FreeMusic( music );
  CloseEntitySystem();
  CloseSpriteSystem();
  exit(0);		/*technically this will end the program, but the compiler likes all functions that can return a value TO return a value*/ 
 return 0;
}