void DeviceGraphicsDX11Renderer::openDisplay			(DTuint width, DTuint height, void *data)
{
	//LOG_MESSAGE << "Vendor:     " << //::glGetString(GL_VENDOR);
	//LOG_MESSAGE << "Renderer:   " << //::glGetString(GL_RENDERER);
	//LOG_MESSAGE << "Version:    " << //::glGetString(GL_VERSION);
	//LOG_MESSAGE << "Extensions: " << //::glGetString(GL_EXTENSIONS);

    // Extract all of the extra data
    OpenDisplayData *odata = reinterpret_cast<OpenDisplayData*>(data);

    _d3dDevice = odata->d3dDevice;
    _d3dContext = odata->d3dContext;
    _swapChain = odata->swapChain;
    _renderTargetView = odata->renderTargetView;
    _depthStencilView = odata->depthStencilView;
    _swapCallback = odata->swapCallback;

    _current_render_target_view = _renderTargetView.Get();
	_current_depth_stencil_view = _depthStencilView.Get();  

	getRenderParameters();
    
	changeDisplay(width,height);
    DeviceGraphics::openDisplay(width, height, data);


}
Example #2
0
void taskLayer::testMessage(Ref * message) {

	BaseSprite * sprite = dynamic_cast<BaseSprite *> (message);
	std::string name = sprite->getM_name();

	ValueMap taskMap = DataXML::getInstence()->getTask();

	for (auto taskName : taskMap)
	{
	 	std::string taskKey = taskName.first.c_str();
	 	if (name == taskKey)
	 	{
	 		for(auto v :allCondition){
	 			std::string key = v.first.c_str();
	 			if (name == key && allCondition.at(name).asInt() < taskMap.at(name).asInt())
	 			{
					//增加吃到道具数量达到任务要求后的处理!!!!!!!!!!!!!!!!!!!!别忘了
	 				int number = allCondition.at(name).asInt() + 1;
	 				allCondition[key] = number;

					//更改Label显示,更换黄匡
					changeDisplay(name);
	 			}
	 		}
	 	}
	}
}
Example #3
0
void initVideoData(void) {
    int i;

    gScreen = (Visual*) malloc(sizeof(Visual));
    gViewportType = getSettingi("display_type");

    {
        Visual *d = gScreen;
        d->w = getSettingi("width");
        d->h = getSettingi("height");
        d->vp_x = 0;
        d->vp_y = 0;
        d->vp_w = d->w;
        d->vp_h = d->h;
        d->onScreen = -1;
        d->textures = (unsigned int*) malloc(game_textures * sizeof(unsigned int));
    }

    gPlayerVisuals = (PlayerVisual*) malloc(MAX_PLAYERS * sizeof(PlayerVisual));

    loadModels();

    for(i = 0; i < eHUDElementCount; i++)
    {
        gpHUD[i] = NULL;
    }

    changeDisplay(-1);
}
Example #4
0
void Switches_Process(void){
//------------------------------------------------------------------------------
//===========================================================================
// Function name: Switches_Process
//
// Description: Handle and debounce switch 1 and 2
// 
// Passed : no variables passed
// Locals: no variables declared
// Returned: no values returned
// Globals: waitCount, buttOne, buttTwo
// Calls: lcd_clear, changeDisplay
//
// Author: Joseph Jarriel
// Date: Sep 2014
// Compiler: Built with IAR Embedded Workbench Version (6.10.5)
// ==========================================================================
//------------------------------------------------------------------------------
  if ((!(P4IN & SW1)) && (waitCount > TIME_UP)){
    waitCount = RESTART;
    lcd_clear();
    //buttOne = !buttOne;
    buttOne++;
    changeDisplay();
  }
  if ((!(P4IN & SW2)) && (waitCount > TIME_UP)) {
    waitCount = RESTART;
    //lcd_clear();
    //buttTwo = !buttTwo;
    move(5);
  }
//------------------------------------------------------------------------------
}
int c_startGame(lua_State *L) { 
	game2->mode = GAME_SINGLE;
	game_ResetData();
	video_ResetData();
	changeDisplay(-1);
	nebu_System_ExitLoop(RETURN_GAME_LAUNCH);
	return 0;
}
int c_video_restart(lua_State *L) {
	initGameScreen();
	shutdownDisplay( gScreen );
	setupDisplay( gScreen );
	updateCallbacks();
	changeDisplay(-1);
	return 0;
}
Example #7
0
void reshape(int x, int y) {
  if(x < game->settings->height || x < game->settings->width)
    initGameScreen();
  if(x > game->settings->width )
    game->screen->vp_x = (x - game->settings->width) / 2;
  if(y > game->settings->height )
    game->screen->vp_y = (y - game->settings->height) / 2;
  changeDisplay();
}
Example #8
0
void reshape(int x, int y) {
    if(x < getSettingi("height") || x < getSettingi("width"))
        initGameScreen();
    if(x > getSettingi("width") )
        gScreen->vp_x = (x - getSettingi("width")) / 2;
    if(y > getSettingi("height") )
        gScreen->vp_y = (y - getSettingi("height")) / 2;
    changeDisplay(-1);
}
Example #9
0
void keyboardPause(int state, int key, int x, int y) {
	if(state == NEBU_INPUT_KEYSTATE_UP)
		return;

	switch(key) {
	case 27:
		nebu_System_ExitLoop(eSRC_Pause_Escape);
		break;
	case SYSTEM_KEY_F1: changeDisplay(0); break;
	case SYSTEM_KEY_F2: changeDisplay(1); break;
	case SYSTEM_KEY_F3: changeDisplay(2); break;
	case SYSTEM_KEY_F4: changeDisplay(3); break;

		// somehow, this breaks the 'keys' array, and saving
		// at the end of the game fails
		// case SYSTEM_KEY_F5: saveSettings(); return;

	case SYSTEM_KEY_F10: nextCameraType(); break;

	case SYSTEM_KEY_F11: doBmpScreenShot(gScreen); break;
	case SYSTEM_KEY_F12: doPngScreenShot(gScreen); break;
	    
	case SYSTEM_KEY_UP: console_Seek(-1); break;
	case SYSTEM_KEY_DOWN: console_Seek(1); break;

	case SYSTEM_KEY_TAB: 
		// nebu_System_ExitLoop(RETURN_MENU_PROMPT);
		break;

	default:
		if(game->pauseflag == PAUSE_GAME_FINISHED) {
			game_ResetData();
			video_ResetData();
		}
		else
		{
			game->pauseflag = PAUSE_GAME_RUNNING;
			nebu_System_ExitLoop(eSRC_Game_Unpause);
		}
		/* lasttime = SystemGetElapsedTime(); */
		break;
	}
}
void SymbolView::HandleContextMenu(QPoint)
{
	QMenu *pmenu = new QMenu();
	QAction* viewAct;
	viewAct = pmenu->addAction( tr("Display Icons only"));
	viewAct->setCheckable(true);
	viewAct->setChecked(delegate->iconOnly());
	connect(viewAct, SIGNAL(triggered()), this, SLOT(changeDisplay()));
	pmenu->exec(QCursor::pos());
	delete pmenu;
}
	void Slot::setDisplayList(std::vector<Object*> value) {
		displayList.resize(value.size());
		int i = value.size();
		while(i --)
		{
			displayList[i] = value[i];
		}
			
		if(_displayIndex >= 0)
		{
			_displayIndex = -1;
			changeDisplay(_displayIndex);
		}
	}
Example #12
0
 void Slot::setDisplayList(const std::vector<Object*> &value)
 {
     int i = value.size();
     _displayList.resize(i);
     while(i --)
     {
         _displayList[i] = value[i];
     }
     
     if(_displayIndex >= 0)
     {
         int displayIndexBackup = _displayIndex;
         _displayIndex = -1;
         changeDisplay(displayIndexBackup);
     }
 }
Example #13
0
void Win32Window::updateSize() {
	
	RECT rcClient;
	BOOL ret = GetClientRect(m_hWnd, &rcClient);
	
	if(!ret || rcClient.right == rcClient.left || rcClient.bottom == rcClient.top) {
		LogWarning << "Ignoring bad window size: (" << rcClient.left << ", " << rcClient.top
		           << ") -- (" << rcClient.right << ", " << rcClient.bottom << ")";
	}
	
	Vec2i newSize = Vec2i(rcClient.right - rcClient.left, rcClient.bottom - rcClient.top);
	
	if(newSize != size_) {
		onResize(newSize.x, newSize.y);
		changeDisplay(0);
	}
}
Example #14
0
void Slot::setDisplayList(const std::vector<std::pair<void*, DisplayType>> &displayList, bool disposeExisting)
{
    if (_displayIndex < 0)
    {
        _isShowDisplay = true;
        _displayIndex = 0;
    }
    
    if (disposeExisting)
    {
        disposeDisplayList();
        _childArmature = nullptr;
        _display = nullptr;
    }
    
    // copy
    _displayList = displayList;
    int displayIndexBackup = _displayIndex;
    _displayIndex = -1;
    changeDisplay(displayIndexBackup);
}
Example #15
0
void ShapeView::HandleContextMenu(QPoint)
{
	QMenu *pmenu = new QMenu();
	if (this->count() != 0)
	{
		QListWidgetItem* it = currentItem();
		if (it != NULL)
		{
			QAction* delAct = pmenu->addAction( tr("Delete selected Shape"));
			connect(delAct, SIGNAL(triggered()), this, SLOT(delOne()));
		}
		QAction* delAAct = pmenu->addAction( tr("Delete all Shapes"));
		connect(delAAct, SIGNAL(triggered()), this, SLOT(deleteAll()));
		pmenu->addSeparator();
	}
	QAction* viewAct = pmenu->addAction( tr("Display Icons only"));
	viewAct->setCheckable(true);
	viewAct->setChecked(delegate->iconOnly());
	connect(viewAct, SIGNAL(triggered()), this, SLOT(changeDisplay()));
	pmenu->exec(QCursor::pos());
	delete pmenu;
}
Example #16
0
void keyGame(int state, int k, int x, int y)
{
  int i;

	if(state == SYSTEM_KEYSTATE_DOWN) {
		switch (k) {
			/* case 'q': SystemExit(); return; */
		case 27:
			game->pauseflag = PAUSE_GAME_SUSPENDED;
			nebu_System_ExitLoop(RETURN_GAME_ESCAPE);
			return;
		case ' ':
			game->pauseflag = PAUSE_GAME_SUSPENDED;
			nebu_System_ExitLoop(RETURN_GAME_PAUSE);
			return;
		case SYSTEM_KEY_F1: changeDisplay(0); return;
		case SYSTEM_KEY_F2: changeDisplay(1); return;
		case SYSTEM_KEY_F3: changeDisplay(2); return;
		case SYSTEM_KEY_F4: changeDisplay(3); return;

		// somehow, this breaks the 'keys' array, and saving
		// at the end of the game fails
		// case SYSTEM_KEY_F5: saveSettings(); return;

		case SYSTEM_KEY_F10: nextCameraType(); return;
		case SYSTEM_KEY_F11: doBmpScreenShot(gScreen); return;
		case SYSTEM_KEY_F12: doPngScreenShot(gScreen); return;

		case SYSTEM_KEY_F6: console_Seek(-1); return;
		case SYSTEM_KEY_F7: console_Seek(1); return;
    /* toggle lighting
  case SYSTEM_KEY_F6: 
      setSettingi("light_cycles", !game->settings->light_cycles);
      return;
    */
		}
	}
	for( i = 0; i < game->players; i++) {
		if(PLAYER_IS_ACTIVE(&game->player[i]) &&
			 !game->player[i].ai->active) {
			int key;
			if(state == SYSTEM_KEYSTATE_DOWN) { 
				scripting_RunFormat("return settings.keys[%d].left", i + 1);
				scripting_GetIntegerResult( &key );
				if(key == k) {
					createEvent(i, EVENT_TURN_LEFT);
					return;
				}
				scripting_RunFormat("return settings.keys[%d].right", i + 1);
				scripting_GetIntegerResult( &key );
				if(key == k) {
					createEvent(i, EVENT_TURN_RIGHT);
					return;
				}
			}
			// deal with glance keys
			scripting_RunFormat("return settings.keys[%d].glance_left", i + 1);
			scripting_GetIntegerResult( &key );
			if(key == k) {
				if(state == SYSTEM_KEYSTATE_DOWN) {
					// printf("glance left down\n");
					game->player[i].camera->movement[CAM_PHI_OFFSET] = PI / 2.0f;
				}	else {
					// printf("glance left up\n");
					game->player[i].camera->movement[CAM_PHI_OFFSET] = 0;
				}
				return;
			}
			// deal with glance keys
			scripting_RunFormat("return settings.keys[%d].glance_right", i + 1);
			scripting_GetIntegerResult( &key );
			if(key == k) {
				if(state == SYSTEM_KEYSTATE_DOWN) {
					// printf("glance right down\n");
					game->player[i].camera->movement[CAM_PHI_OFFSET] = - PI / 2.0f;
				} else {
					// printf("glance right up\n");
					game->player[i].camera->movement[CAM_PHI_OFFSET] = 0;
				}
				return;
			}
			// boost
			scripting_RunFormat("return settings.keys[%d].boost", i + 1);
			scripting_GetIntegerResult( &key );
			if(key == k) {
				if(state == SYSTEM_KEYSTATE_DOWN) {
					// printf("boost down\n");
					if(game->player[i].data->booster > getSettingf("booster_min"))
						game->player[i].data->boost_enabled = 1;
				} else {
					// printf("boost up\n");
					game->player[i].data->boost_enabled = 0;
				}
				return;
			}
			// wallbuster
			scripting_RunFormat("return settings.keys[%d].bust", i + 1);
			scripting_GetIntegerResult( &key );
			if(key == k) {
				if(state == SYSTEM_KEYSTATE_DOWN) {
					// printf("wall_buster down\n");
					if(game->player[i].data->wall_buster > getSettingf("wall_buster_min"))
						game->player[i].data->wall_buster_enabled = 1;
				} else {
					// printf("wall_buster up\n");
					game->player[i].data->wall_buster_enabled = 0;
				}
				return;
			}
		}
	}
	if(state == SYSTEM_KEYSTATE_DOWN) {
		displayMessage(TO_STDERR, "key '%s' (%d) is not bound", 
									 SystemGetKeyName(k), k);
	}
}
void inputWidget::btn_clicked(int btn)
{
    QString strKeyId;
    QString ch;
    strKeyId = allButtons.at(btn)->accessibleName();    
    bool isOk;
    int keyId = strKeyId.toInt(&isOk, 16);
    if(checkNotTextKey(keyId)){
        if(keyId == Qt::Key_Enter)
            emit sendHide();
        else if(keyId == Qt::Key_Backspace)
        {
            if(!isEnglish && !(this->lineEditInput->text().isEmpty()))
            {
                if(isPinyin)
                {
                    pinyinStr.chop(1);
                    this->lineEditInput->setText(pinyinStr);                    
                }
                else
                {                    
                    wubinStr.chop(1);
                    this->lineEditInput->setText(wubinStr);
                }
            }
            else
                QWSServer::sendKeyEvent(0,Qt::Key_Backspace,Qt::NoModifier,true,false);
        }
        else if(keyId == Qt::Key_Return)              
            emit sendHide();
        else if(keyId == Qt::Key_Delete)
            QWSServer::sendKeyEvent(0,Qt::Key_Delete,Qt::NoModifier,true,false);
        else if(keyId == Qt::Key_Left)
            QWSServer::sendKeyEvent(0,Qt::Key_Left,Qt::NoModifier,true,false);
        else if(keyId == Qt::Key_Right)
            QWSServer::sendKeyEvent(0,Qt::Key_Right,Qt::NoModifier,true,false);
        else if(keyId == Qt::Key_PageUp)
        {
            if(!isEnglish)
                changeDisplay(isEnglish);
        }
        else if(keyId == Qt::Key_PageDown)
        {
            if(!isEnglish)
                changeDisplay(!isEnglish);
        }
        return;
    }
    if(keyId == Qt::Key_Space)
        ch = " ";
    else
        ch = allButtons.at(btn)->text().trimmed();

    if(!isEnglish)
    {
        if(checkNUMKey(keyId))
        {
            int tmpNum=keyId-48;
            if(!(tmpNum>displayNumEnd-displayNumBegin || tmpNum==0))
            {
                tmpNum=tmpNum+displayNumBegin-1;
                if(isPinyin)
                {
//                    QSqlTableModel model(this->db);
                    model->setTable("pinyin");
                    model->setFilter(QString("py like '%1'").arg(pinyinStr+"%"));
                    model->setSort(0,Qt::AscendingOrder);
                    model->select();
                    chineseStr=model->record(tmpNum).value("chn").toString();
                }
                else
                {
//                    QSqlTableModel model(this->db);
                    model->setTable("wubi");
                    model->setFilter(QString("wb like '%1'").arg(wubinStr+"%"));
                    model->setSort(0,Qt::AscendingOrder);
                    model->select();
                    chineseStr=model->record(tmpNum).value("chn").toString();
                }
                this->hzBtnPre->setDisabled(true);
                this->lhzBtnBack->setDisabled(true);
                this->lineEditInput->setText("");
                this->labelInput->setText("");
                displayNumBegin =0;
                displayNumEnd =0;
                emit sendString(chineseStr);
            }
        }
        else
            this->lineEditInput->setText(this->lineEditInput->text().trimmed()+ch);        
    }
    else
        emit sendString(ch);
}
Example #18
0
void initGameStructures() { /* called only once */
  /* default art names */
  char *path;
  /* init game screen */
  /* init players. for each player: */
  /*   init model */
  /*   init display */
  /*   init ai */
  /*   create data */
  /*     create trails */
  /*   create camera */

  gDisplay *d;
  int i;
  /* int onScreen; */
  /* Data *data; */
  /* Camera *c; */
  /* Model *m; */
  AI *ai;
  Player *p;

  game->winner = -1;
  game->screen = (gDisplay*) malloc(sizeof(gDisplay));
  d = game->screen;
  d->h = game->settings->height; d->w = game->settings->width;
  d->vp_x = 0; d->vp_y = 0;
  d->vp_w = d->w; d->vp_h = d->h;
  d->blending = 1;
  d->fog = 0;
  d->shademodel = GL_SMOOTH;
  d->wall = 1;
  d->onScreen = -1;
  d->textures = (unsigned int*) malloc(game_textures * sizeof(unsigned int));
  


  //Setup display here
  setupDisplay(game->screen);
  
  game->players = PLAYERS;
  game->player = (Player *) malloc(MAX_PLAYERS * sizeof(Player));
  for(i = 0; i < game->players; i++) {
    p = (game->player + i);
    p->model = (Model*) malloc(sizeof(Model));
    p->display = (gDisplay*) malloc(sizeof(gDisplay));
    p->ai = (AI*) malloc(sizeof(AI));
    p->data = (Data*) malloc(sizeof(Data));
    p->data->trails = (line*) malloc(MAX_TRAIL * sizeof(line));
    p->camera = (Camera*) malloc(sizeof(Camera));
    p->camera->type = (CameraType*) malloc(sizeof(CameraType));

    /* init model & display & ai */
    update_splash(splash, 0.3+i*.1, "init model");
    initModel(p, i);

    ai = p->ai;
    if(game->settings->screenSaver) {
      ai->active = AI_COMPUTER;
    } else {
      switch(i) {
      case 0: ai->active = game->settings->ai_player1; break;
      case 1: ai->active = game->settings->ai_player2; break;
      case 2: ai->active = game->settings->ai_player3; break;
      case 3: ai->active = game->settings->ai_player4; break;
      default:
	fprintf(stderr, "player index #%d not caught!\n", i);
	ai->active = AI_NONE;
      }
    }
    ai->tdiff = 0;
    ai->moves = 0;
    ai->danger = 0;
    ai->lastx = 0;
    ai->lasty = 0;
  }

  /* load recognizer model */
  update_splash(splash, 0.7, "loading recognizer");
  path = getFullPath("recognizer.obj");
  if(path != NULL)
    // recognizer = loadModel(path, RECOGNIZER_HEIGHT, 0);
    // recognizer = loadModel(path, 60, MODEL_NORMALIZE | MODEL_INVERT_NORMALS);
    recognizer = loadModel(path, 60, MODEL_NORMALIZE );
  else {
    printf("fatal: could not load recognizer - exiting...\n");
    exit(1);
  }
  free(path);


  changeDisplay();

  game2->events.next = NULL;
  game2->mode = GAME_SINGLE;
}
void ReceiveQuestion::createActions()
{
    connect(ui->sendAnswerBtn,SIGNAL(released()),this,SLOT(answerSentSlot()));
    connect(timer,SIGNAL(timeout()),SLOT(changeDisplay()));
  //  connect(this,SIGNAL(accepted()),this,SLOT(deleteLater()));////!!!!!!!!!!!!!!!!!!!!!!!
}