コード例 #1
0
void LanguageResourceModel::setResourceManager(ResourceManager *resourceManager)
{
    if (m_resourceManager == resourceManager) {
        return;
    }

    beginResetModel();

    if (m_resourceManager) {
        m_resourceManager->disconnect(this);
    }

    m_resourceManager = resourceManager;

    if (m_resourceManager) {
        connect(m_resourceManager, SIGNAL(languageResourceAboutToBeAdded(LanguageResource*,int)),
                SLOT(onLanguageResourceAboutToBeAdded(LanguageResource*,int)));
        connect(m_resourceManager, SIGNAL(languageResourceAdded()),
                SLOT(onLanguageResourceAdded()));
        connect(m_resourceManager, SIGNAL(languageResourceAboutToBeRemoved(int)),
                SLOT(onLanguageResourceAboutToBeRemoved(int)));
        connect(m_resourceManager, SIGNAL(languageResourceRemoved()),
                SLOT(onLanguageResourceRemoved()));
        connect(m_resourceManager, SIGNAL(languageCoursesChanged()),
                SLOT(updateDisplayedLanguages()));
    }
    updateResources();

    endResetModel();

    emit resourceManagerChanged();
}
コード例 #2
0
ファイル: textlayer.cpp プロジェクト: andrejsavikin/mishira
void TextLayer::render(
	VidgfxContext *gfx, Scene *scene, uint frameNum, int numDropped)
{
	// Has the layer width changed since we rendered the document texture?
	if(m_rect.width() != m_document.textWidth()) {
		// It has, we need to repaint the document texture
		m_isTexDirty = true;
		updateResources(gfx);
	}

	VidgfxVertBuf *vertBuf = vidgfx_texdecalbuf_get_vert_buf(m_vertBuf);
	if(m_texture == NULL || vertBuf == NULL)
		return; // Nothing to render

	vidgfx_context_set_shader(gfx, GfxTexDecalShader);
	vidgfx_context_set_topology(
		gfx, vidgfx_texdecalbuf_get_topology(m_vertBuf));
	vidgfx_context_set_blending(gfx, GfxAlphaBlending);
	QColor prevCol = vidgfx_context_get_tex_decal_mod_color(gfx);
	vidgfx_context_set_tex_decal_mod_color(
		gfx, QColor(255, 255, 255, (int)(getOpacity() * 255.0f)));
	vidgfx_context_set_tex(gfx, m_texture);
	vidgfx_context_set_tex_filter(gfx, GfxBilinearFilter);
	vidgfx_context_draw_buf(gfx, vertBuf);
	vidgfx_context_set_tex_decal_mod_color(gfx, prevCol);
}
コード例 #3
0
void LanguageResourceModel::setView(LanguageModel::LanguageResourceView view)
{
    if (m_view == view) {
        return;
    }
    emit beginResetModel();
    m_view = view;
    updateResources();
    emit endResetModel();
}
コード例 #4
0
ファイル: textlayer.cpp プロジェクト: andrejsavikin/mishira
void TextLayer::initializeResources(VidgfxContext *gfx)
{
	appLog(LOG_CAT)
		<< "Creating hardware resources for layer " << getIdString();

	vidgfx_texdecalbuf_set_context(m_vertBuf, gfx);
	vidgfx_texdecalbuf_set_rect(m_vertBuf, QRectF());
	vidgfx_texdecalbuf_set_tex_uv(m_vertBuf, QRectF());
	m_isTexDirty = true;
	updateResources(gfx);
}
コード例 #5
0
void LanguageResourceModel::updateDisplayedLanguages()
{
    emit beginResetModel();
    updateResources();
    emit endResetModel();
}
コード例 #6
0
ファイル: spqr.c プロジェクト: ChrisCooper/SPQR
int SPQR_Game()
{
	//initializeAllObjects();

	int randomizer = 0;                    //Used for random timing of events

   inGame = 1;
	//The main game loop
	while (inGame)
    {

/*
	All timers use the format:

	if (timerVar less than 'X' and not the same as last time)
	{
		do_something;
	}
	else if (more than 'X')
	{
		do_something_else;
		reset timerVar;
	}

*/

			//Timer for updating money
			if (time(0) % 3 == 0 && moneyNotDone)//excecute every 3 seconds
			{
				updateMoney();
				moneyNotDone = 0;
			}
			else if (time(0) % 3 != 0)
			{
            moneyNotDone = 1;
			}

         /*Counter for playing ambient sounds, and updating resources     60 BPM*/
         if (economyCounter != economyCounterCheck)
			{
            checkThresholds();
            updateResources();
				calculatePopulation();
				if (!(economyCounter % 5)) // every 5 cycles
				{
					updateHousing();
				}
            economyCounterCheck = economyCounter;
				//playAmbientSound();
				if (!(randomizer = rand() % 2))
				{
					play_sample(ambientSound[rand() % NUMABIENTSOUNDS], 255, 127, 1000, 0);
				}
			}

			/*Counter for updating atributes of people        4 BPS*/
          if (updateCounter < 100000 && updateCounterCheck != updateCounter)
          {
              updatePeople();
					sortPeople();
              updateCounterCheck = updateCounter;
          }
          else
          {
              updateCounter = 0;
          }

			/*Counter for animation of people                 8 BPS*/
          if (animateCounter < 100000 && animateCounterCheck != animateCounter)
          {
              animatePeople();
					movePeople();
					sortPeople();
					calculatePercentages();
              animateCounterCheck = animateCounter;
          }
          else
          {
              animateCounter = 0;
          }

			/*Main logic vs. visuals loop                      60 BPS*/
			if (speedCounterCheck == speedCounter)
			{
			}
			else if (speedCounter > 1)
			{
              speedCounter = 0;
              gameVisuals();
			}
         else if (speedCounterCheck != speedCounter)
         {
              getInput();
              speedCounterCheck = speedCounter;
         }
    }
	return 0;
}