예제 #1
0
파일: Sound.cpp 프로젝트: remar/castle
Sound::Sound()
{
  mmInitDefaultMem((mm_addr)soundbank_bin);
  mmLoad(MOD_CASTLE_MUSIC);
  mmStart(MOD_CASTLE_MUSIC, MM_PLAY_LOOP);

  initEffects();
}
예제 #2
0
파일: title.c 프로젝트: akien-mga/tbftss
void initTitle(void)
{
	startSectionTransition();
	
	stopMusic();
	
	app.delegate.logic = &logic;
	app.delegate.draw = &draw;
	memset(&app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS);
	
	battle.camera.x =  battle.camera.y = 0;
	
	destroyBattle();
	
	logo = getTexture("gfx/title/logo.png");
	
	pandoranWar = getTexture("gfx/title/pandoran.png");
	
	background = getTexture("gfx/backgrounds/background02.jpg");
	
	earthTexture = getTexture("gfx/planets/earth.png");
	
	earth.x = rand() % SCREEN_WIDTH;
	earth.y = -(128 + (rand() % 128));
	
	initBackground();
	
	initEffects();
	
	initFighters();
	
	updateAllMissions();
	
	getWidget("campaign", "title")->action = campaign;
	getWidget("challenges", "title")->action = challenges;
	getWidget("trophies", "title")->action = trophies;
	getWidget("stats", "title")->action = stats;
	getWidget("fighterDB", "title")->action = fighterDatabase;
	getWidget("options", "title")->action = options;
	getWidget("credits", "title")->action = credits;
	getWidget("quit", "title")->action = quit;
	
	getWidget("ok", "stats")->action = ok;
	getWidget("ok", "trophies")->action = ok;
	getWidget("ok", "fighterDB")->action = ok;
	
	show = SHOW_TITLE;
	
	endSectionTransition();
	
	playMusic("music/main/Rise of spirit.ogg", 0);
}
예제 #3
0
파일: main.cpp 프로젝트: Dewb/moody
int main()
{
    int width = 51 * 6; // lengths of strips
    int height = 4;
    uint8_t* buffer = (uint8_t*)malloc(width * height * 3);
    
    createNetwork(buffer, width, height);
    initEffects(width, height);
    
    while (1)
    {
        clearEffect(buffer);
        
        //runTestEffect(buffer);
        //runFlameEffect(buffer);
        runWaterfallEffect(buffer);

        applyFixups(buffer, width, height);
        
#if OSC_OUTPUT_ENABLED
        for (int ii = 0; ii < width; ii++)
        {
            for (int jj = 0; jj < height; jj++)
            {
                oscStream << osc::BeginBundleImmediate;
                oscStream << osc::BeginMessage("led");
                oscStream << ii * 3 << (height - jj - 1) * 10 << (ii + 1) * 3 << (height - jj) * 10;
                int s = (jj * width + ii) * 3;
                for (int c = 0; c < 3; c++)
                {
                    oscStream << buffer[s + c];
                }
                oscStream << osc::EndMessage;
                oscStream << osc::EndBundle;
                oscSocket.Send(oscStream.Data(), oscStream.Size());
                oscStream.Clear();
            }
        }
        
#endif
                
        for (int ii = 0; ii < supplies.size(); ii++)
        {
            supplies[ii]->go();
        }
        usleep(70);
    }
    
    free(buffer);
    return 0;
}
예제 #4
0
파일: demo.cpp 프로젝트: leavittx/revenge
void Demo::update()
{
#ifdef _WIN32
	bool F1 = GetAsyncKeyState(VK_F1) != 0; //reload params & shaders
	bool F2 = GetAsyncKeyState(VK_F2) != 0; //reload params & shaders & reinit effects
	bool F3 = GetAsyncKeyState(VK_F3) != 0; //reload resources
	bool S = GetAsyncKeyState('S') != 0;	//toggle sound

	if (F1 || F2)
	{
		Parser parser;
		parser.parse(m_scriptName, g_params, g_system);
		g_shaders.freeShaders();
		g_shaders.loadShaders();
	}
	if (F2)
	{
		releaseEffects();
		initEffects();
	}
	if (F3)
	{
	}

	if (S)
	{
		bool sound = g_system.getSoundEnabled();
		g_system.setSoundEnabled(!sound);
	}

	static bool returnDown = false;
	static int returnTime = 0;
	if (GetAsyncKeyState(VK_RETURN))
	{
		if (!returnDown)
		{
			//write down time if return was pressed
			returnDown = true;
			returnTime = g_system.getTime();
		}
	}
	else
	{
		if (returnDown)
		{
			//return was raised
			int returnLength = g_system.getTime() - returnTime;
			stringstream output;
			output << returnTime;
			output << " ";
			output << returnLength;
			g_debug + (output.str());//(returnTime + " " + returnLength);
			returnDown = false;
		}
	}
#else
	//TODO: that all doesn't work at all :(
	bool F1 = g_system.getKeyDown(KeyF1) != 0;  //reload params & shaders
	bool F2 = g_system.getKeyDown(KeyF2) != 0;  //reload params & shaders & reinit effects
	bool F3 = g_system.getKeyDown(KeyF3) != 0;  //reload resources
	bool S = g_system.getKeyDown(KeyS) != 0;	//toggle sound
	bool F11 = g_system.getKeyDown(KeyF11) != 0; //reload fullscreen

	if (F1 || F2)
	{
		Parser parser;
		parser.parse(m_scriptName, g_params, g_system);
		g_shaders.freeShaders();
		g_shaders.loadShaders();
	}
	if (F2)
	{
		releaseEffects();
		initEffects();
	}
	if (F3)
	{
	}

	if (S)
	{
		bool sound = g_system.getSoundEnabled();
		g_system.setSoundEnabled(!sound);
	}

	if (F11)
	{
		//Segmentation fault on glxSwapBuffers() call
		//        GLWindow glWindow = g_system.getGLWindow();
		//        glWindow.toggleFullscreen();
	}
#endif

	if (m_running)
	{
		vector<TimelineEntry*>::iterator it;
		int time = g_system.getTime();

		for (it = m_timeline.begin(); it < m_timeline.end(); it++)
		{
			TimelineEntry *e = *it;
			if (time >= e->m_startTime && time < e->m_endTime)
			{
				float t = Math::calcPosInt(time, e->m_startTime, e->m_endTime);

				e->m_scene->setPosition(t);
				e->m_frametimer->update(time);
				while (e->m_frametimer->stepsLeft())
				{
					e->m_scene->update();
					e->m_frametimer->endStep();
				}
			}
		}
	}
}
예제 #5
0
EffectManager::EffectManager()
{
	initEffects();
}