Exemple #1
0
void Starfield::resetValues()
{
	movementSpeed = 2;
	speed = 1.f;
	speed2 = 1.f;
	color = 0x20;
	changePattern(patternIter);
}
Exemple #2
0
Starfield::Starfield()
	: pattern(0), patternIter(patternList), messageDisplayTime(0), showHelp(false)
{
	loadHelp();
	patterns::addPatterns(*this);

	changePattern(IterType(patternList.begin(), patternList));
	resetValues();

	for (unsigned int i = 0; i < stars.size(); ++i)
	{
		stars[i] = pattern->newStar();
		stars[i].z = i * stars.size() / 500;
	}
}
Exemple #3
0
void handle_input(void)
{
	#ifndef NO_USB

	static uint16_t prev_buttons;

	int b = gamepad_buttons[0] & ~prev_buttons; // new buttons

	if (gamepad_buttons[0] & gamepad_X) { // control - key ? (press X before)
		if ( b & gamepad_up )   memcpy(&clipboard,&Player.currentPattern, sizeof(Pattern)); // copy
		if ( b & gamepad_down ) memcpy(&Player.currentPattern,&clipboard,sizeof(Pattern)); // paste
		if ( b & gamepad_A ) zap_pattern(&Player.currentPattern); // zap

		if ( b & gamepad_R && Player.orderIndex < Mod.songLength) {
			// next pattern
			Player.orderIndex+=1;
			changePattern();
		}

		if ( b & gamepad_L && Player.orderIndex>0 ) {
			// prev pattern
			Player.orderIndex-=1;
			changePattern();
		}
	} else {
		if ( b & gamepad_up ) sampler.cursor_y -=1;
		if ( b & gamepad_down ) sampler.cursor_y +=1;
		sampler.cursor_y &= 0x7; // 8 channels

		if ( b & gamepad_left) sampler.cursor_x -=1;
		if ( b & gamepad_right) sampler.cursor_x +=1;
		sampler.cursor_x &= 0xf;

		int bpm = 5* SAMPLERATE  / Player.samplesPerTick /2;
		if ( b & gamepad_L) bpm -= DELTA_BPM;
		if ( b & gamepad_R) bpm += DELTA_BPM;
		Player.samplesPerTick = SAMPLERATE / (2 * bpm / 5);

		// shorter to type
		uint8_t *s = &Player.currentPattern.sampleNumber[sampler.cursor_x*4][sampler.cursor_y];
		uint16_t *n = &Player.currentPattern.note[sampler.cursor_x*4][sampler.cursor_y];

		// toggle pad to A if in B or 0 ; set to zero if already set
		if (b & gamepad_A ) {
			if (*s == sampler.cursor_y+1) {
				*s = 0;
				*n = NONOTE;
			} else {
				*s = sampler.cursor_y+1;
				*n = C4NOTE; 
			}
		}

		// toggle pad to B if in A or 0 ; set to zero if already set
		if (b & gamepad_B) {
			if (*s == sampler.cursor_y+1+8) {
				*s = 0;
				*n = NONOTE;
			} else {
				*s = sampler.cursor_y+1+8;
				*n = C4NOTE; 
			}
		}
	}
	prev_buttons = gamepad_buttons[0];
	#endif
}
Exemple #4
0
void Starfield::prevPattern()
{
	--patternIter;
	changePattern(patternIter);
}
Exemple #5
0
void Starfield::nextPattern()
{
	++patternIter;
	changePattern(patternIter);
}