Exemplo n.º 1
0
	Mover(){
		//hitsound
		hitsound.loadSound("HitSound.wav");
		maxspeed= ofRandom(1,2); //maxspeed and different for aal circles
		accel = ofPoint(-.001, .01);
		location = ofPoint(ofRandom(ofGetWidth()), ofRandom(ofGetHeight()));  //random start of the circle
		velocity = ofPoint(ofRandom(-2.0,2.0), ofRandom(-2.0,2.0)); // random speed

		ofSetColor(100, ofRandom(255),100);
	}
Exemplo n.º 2
0
//--------------------------------------------------------------
void ofApp::setup() {

    score = 0;
    keyup = false;
    keydown = false;
    bal.setup();
    player.setup();
    pling.loadSound("pling.wav");
    werk = true;


}
Exemplo n.º 3
0
void Bubble::setup(int _x, int _y) {
    ofEnableSmoothing();
    ofEnableAlphaBlending();
    
    ofSetFrameRate(60);
    
    x = _x;
    y = _y;
    bubbleSize = ofRandom(10,50);
    
    color = ofColor(ofRandom(255),ofRandom(255),ofRandom(255));
    
    sound.loadSound("sounds/Mario.mp3");
    
    
}
Exemplo n.º 4
0
void setup() {
	ofSetVerticalSync(true);
	ofSetWindowShape(1024, 768);

	// we add this listener before setting up so the initial circle resolution is correct
	circleResolution.addListener(this, &ofApp::circleResolutionChanged);
	ringButton.addListener(this,&ofApp::ringButtonPressed);

	gui.setup(); // most of the time you don't need a name
	gui.add(filled.setup("fill", true));
	gui.add(radius.setup( "radius", 140, 10, 300 ));
	gui.add(center.setup("center",ofVec2f(ofGetWidth()*.5,ofGetHeight()*.5),ofVec2f(0,0),ofVec2f(ofGetWidth(),ofGetHeight())));
	gui.add(color.setup("color",ofColor(100,100,140),ofColor(0,0),ofColor(255,255)));
	gui.add(circleResolution.setup("circle res", 5, 3, 90));
	gui.add(twoCircles.setup("two circles"));
	gui.add(ringButton.setup("ring"));
	gui.add(screenSize.setup("screen size", ""));

	bHide = true;

	ring.loadSound("ring.wav");
}
//--------------------------------------------------------------
void ofApp::setup()
{
	// Set framerate to 60 FPS
	ofSetFrameRate(60);

	// Load Asteroids from XML
	loadAsteroids();

	// Create Asteroids
	generateAsteroids(4);

	// TODO
	// Setup the following elements:
	// - players
	// - listeners? (depends on how you handle messages between entities)

	noPlayers = 2;
	SpaceShip* player;	
	for (int i = 0; i < noPlayers; i++) {
		player = new SpaceShip(i+1);
		players.push_back(player);
	}

	if (noPlayers == 1) {
		player = new SpaceShip(2, true);
		players.push_back(player);
	}

	//??? ofAddListener(); ???
	//ofAddListener(SpaceShip::pressedKeyEvent, this, &ofApp::keyPressed);

	// General logic
	ofBackground(0); // Set background to black

	// Debug
	debug = false;

	//Load Sounds

	//Explosions
	explosion.loadSound("Explode.aif");
	explosion.setSpeed(1.5f);

	//Music
	music.loadSound("Gradius.mid");
	music.setLoop(true); //Sound will loop
	//music.play();

	//SpaceShip Shots
	shot.loadSound("missile_fire.wav");
	shot.setSpeed(4.0f);
	shot.setVolume(0.3f);
	
	ofxLabel line;

	//GUI Setup
	gui.setup(); // most of the time you don't need a name	
	gui.add(Player1Lifes.setup("Player1 Lifes", "3"));
	gui.add(Player2Lifes.setup("Player2 Lifes", "3"));
	gui.add(Player1Score.setup("Player1 Score", "0"));
	gui.add(Player2Score.setup("Player2 Score", "0"));

}
Exemplo n.º 6
0
//--------------------------------------------------------------
void testApp::setup(){
    
    ofBackground(0);
    ofSetFrameRate(30);
    ofEnableAlphaBlending();
    //    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    //    glEnable(GL_DEPTH_TEST);
    glPointSize(1.0);
    drawFBO = false;
    autoRotate = true;
    drawEQ = false;
    
    //not really needed
    //    glEnable(GL_ALPHA_TEST);
    //    glAlphaFunc(GL_GREATER, 0.10f);
    
    //generate the mesh points
    buildSphereMesh(rad, res, vm);
    cout << "nverts: " << vm.getNumVertices() << endl;
    cout << "arb: " << ofGetUsingArbTex() << ", norm: " << ofGetUsingNormalizedTexCoords() << endl;
    
    //load the texture shader
    shader.load("tex.vert", "tex.frag");
    
    //fft init
    fftSmoothed = new float[8192];
    memset(fftSmoothed, 0x00, sizeof(float) * 8192);
    
    //map the frequencies to bark bands
    float freq_spc = FREQ_MAX / (float)SPECTRAL_BANDS;
    
	for (int i = 0; i < SPECTRAL_BANDS; i++) {
        int bidx = bark(i * freq_spc);
        barkmap[i] = bidx;
    }
    
    //load the position updating frag shader
    pos_shader.load("", "position.frag");
    
    //for the sphere we set this to the resolution which = #of verts along each axis
    fbo_res = res;
    
    //init the fbo's with blank data
    vector<ofVec3f> fbo_init_data;
    fbo_init_data.assign(fbo_res * fbo_res, ofVec3f(0.0, 0.0, 0.0));
    
    posbuf.allocate(fbo_res, fbo_res, GL_RGB32F);
    posbuf.src->getTextureReference().loadData((float *)&fbo_init_data[0], fbo_res, fbo_res, GL_RGB);
    posbuf.dst->getTextureReference().loadData((float *)&fbo_init_data[0], fbo_res, fbo_res, GL_RGB);
    
    //reuse fbo_init_data for no real reason, it just needs to be blank
    eq_tex.allocate(fbo_res, 1, GL_RGB32F_ARB);
    eq_tex.loadData((float *)&fbo_init_data[0], fbo_res, 1, GL_RGB);
    
    axis_loc = fbo_res;
    angincr = 180.0/(float)fbo_res;

    player.loadSound("jhfd.mp3");
    
    player.play(); //go
}