Example #1
0
CubeBox::CubeBox(const CubeBox& box)
      :CubeBoxBase<Cube>(box.dim())
{
   initCubes();

   int i,j;
   for(i=0;i<dim();i++)
      for(j=0;j<dim();j++)
      {
         *cubes[i][j]=*box.cubes[i][j];
      }

   currentPlayer=box.currentPlayer;
}
Example #2
0
CubeBox::CubeBox(KCubeBoxWidget& box)
      :CubeBoxBase<Cube>(box.dim())
{
   initCubes();

   int i,j;
   for(i=0;i<dim();i++)
      for(j=0;j<dim();j++)
      {
        *cubes[i][j]=*box[i][j];
      }

   currentPlayer=(CubeBox::Player)box.player();

}
Example #3
0
int main(int argc, char *argv[])
{

	initializeGlobals();

	EFFECT effect = NONE;

	if ( argc < 2 )
	{
		std::cout << "Insufficient arguments.\n"; 
		usage();
		exit(EXIT_FAILURE);
	}
	
	if ( argc == 3 ) {
		switch ( (int)*argv[2] ) {
			case (int)'0': effect = VOX; break;
			case (int)'1': effect = LOOP; break;
			case (int)'2': effect = SPIRAL; break;
			case (int)'3': effect = FOUNTAIN; break;
			case (int)'4': effect = SPHERE; break;
		}
	} else
		effect = SPHERE;

	/* Initialize */

	void (*renderer)(std::vector<float> specL, std::vector<float> specR);

	if ( effect == SPIRAL ) {
		renderer = analyzeSpectrumSpiral;
		SPECTRUMSIZE = 512;
	} else if ( effect == VOX ) {
		renderer = analyzeSpectrumVox;
		SPECTRUMSIZE = 128;
	} else if ( effect == LOOP ) {
		renderer = analyzeSpectrumLoop;
		SPECTRUMSIZE = 512;
	} else if ( effect == FOUNTAIN ) {
		renderer = analyzeSpectrumFountain;
		SPECTRUMSIZE = 512;
	} else if ( effect == SPHERE ) {
		renderer = analyzeSpectrumSphere;
		SPECTRUMSIZE = 512;
	} else {
		usage();
		exit(EXIT_FAILURE);
	}
	
	FmodHandler fmodHandler(argv[1],renderer,(int)SPECTRUMSIZE);

	fmodHandler.play();
	if (!initScene(effect)) {exit(EXIT_FAILURE);}
	srand ( time(NULL) );
	
	//Initialize cubes
	initCubes(effect);

	/* Main Event Loop. */
	int running = GL_TRUE;
	while (running)
	{
		draw(); 
		fmodHandler.update();
		running = !glfwGetKey(GLFW_KEY_ESC) && glfwGetWindowParam(GLFW_OPENED);
	}
	
	/* Shut down */
	glfwTerminate();
	fmodHandler.release();
	
	return 0;
}
Example #4
0
void initGame(void)
{
	lcdMainOnTop();
	int oldv=getMemFree();
	NOGBA("mem free : %dko (%do)",getMemFree()/1024,getMemFree());
	NOGBA("initializing...");
	videoSetMode(MODE_5_3D | DISPLAY_BG3_ACTIVE);
	videoSetModeSub(MODE_5_2D | DISPLAY_BG3_ACTIVE);
	
	glInit();
	
	vramSetPrimaryBanks(VRAM_A_TEXTURE,VRAM_B_TEXTURE,VRAM_C_LCD,VRAM_D_MAIN_BG_0x06000000);
	vramSetBankH(VRAM_H_SUB_BG);
	vramSetBankI(VRAM_I_SUB_BG_0x06208000);
	
	glEnable(GL_TEXTURE_2D);
	// glEnable(GL_ANTIALIAS);
	glDisable(GL_ANTIALIAS);
	glEnable(GL_BLEND);
	glEnable(GL_OUTLINE);
	
	glSetOutlineColor(0,RGB15(0,0,0)); //TEMP?
	glSetOutlineColor(1,RGB15(0,0,0)); //TEMP?
	glSetOutlineColor(7,RGB15(31,0,0)); //TEMP?
	glSetToonTableRange(0, 15, RGB15(8,8,8)); //TEMP?
	glSetToonTableRange(16, 31, RGB15(24,24,24)); //TEMP?
	
	glClearColor(31,31,0,31);
	glClearPolyID(63);
	glClearDepth(0x7FFF);

	glViewport(0,0,255,191);
	
	// initVramBanks(1);
	initVramBanks(2);
	initTextures();
	initSound();
	
	initCamera(NULL);
	
	initPlayer(NULL);
	
	initLights();
	initParticles();
	
	initMaterials();
	
	loadMaterialSlices("slices.ini");
	loadMaterials("materials.ini");
	loadControlConfiguration("config.ini");
	
	initElevators();
	initWallDoors();
	initTurrets();
	initBigButtons();
	initTimedButtons();
	initEnergyBalls();
	initPlatforms();
	initCubes();
	initEmancipation();
	initDoors();
	initSludge();
	initPause();

	initText();

	NOGBA("lalala");

	getPlayer()->currentRoom=&gameRoom;
	
	currentBuffer=false;
	
	getVramStatus();
	fadeIn();
	
	mainBG=bgInit(3, BgType_Bmp16, BgSize_B16_256x256, 0, 0);
	bgSetPriority(mainBG, 0);
	REG_BG0CNT=BG_PRIORITY(3);
	
	#ifdef DEBUG_GAME
		consoleInit(&bottomScreen, 3, BgType_Text4bpp, BgSize_T_256x256, 16, 0, false, true);
		consoleSelect(&bottomScreen);
	#endif
	
	// glSetToonTableRange(0, 14, RGB15(16,16,16));
	// glSetToonTableRange(15, 31, RGB15(26,26,26));
	
	initPortals();
	
	//PHYSICS
	initPI9();

	strcpy(&mapFilePath[strlen(mapFilePath)-3], "map");
	newReadMap(mapFilePath, NULL, 255);
	
	transferRectangles(&gameRoom);
	makeGrid();
	generateRoomGrid(&gameRoom);
	gameRoom.displayList=generateRoomDisplayList(&gameRoom, vect(0,0,0), vect(0,0,0), false);
	
	getVramStatus();
	
	startPI();

	NOGBA("START mem free : %dko (%do)",getMemFree()/1024,getMemFree());
	NOGBA("vs mem free : %dko (%do)",oldv/1024,oldv);

	levelInfoCounter=60;
}
Example #5
0
int main(int argc, char **argv) {
    int done = FALSE;

    int isActive = TRUE;

    SDL_Event event;

    if (!initSDL()) {
        Quit(1);
    }

    initGL();
//    glutInit( &argc, argv );

    resizeWindow(SCREEN_WIDTH, SCREEN_HEIGHT);

    //init effects
    initCubes();

    while (!done) {

        while (SDL_PollEvent(&event)) {
            switch (event.type) {
                    /*                case SDL_ACTIVEEVENT:
                                        if (event.active.gain == 0)
                                            isActive = FALSE;
                                        else
                                            isActive = TRUE;
                                        break;
                     */
                case SDL_VIDEORESIZE:
                    surface = SDL_SetVideoMode(event.resize.w, event.resize.h, 16, videoFlags);
                    if (!surface) {
                        fprintf(stderr, "Could not get a surface after resize: %s\n", SDL_GetError());
                        Quit(1);
                    }
                    resizeWindow(event.resize.w, event.resize.h);
                    break;

                case SDL_KEYDOWN:
                case SDL_KEYUP:
                    handleKeyPress(event);
                    break;

                case SDL_QUIT:
                    done = TRUE;
                    break;

                default:
                    break;
            }
        }

        if (isActive) {
            //drawGLScene();
            drawQubes();

        }
    }

    Quit(0);

    return ( 0);
}
Example #6
0
CubeBox::CubeBox(const int d)
    :CubeBoxBase<Cube>(d)
{
   initCubes();
}