- [NEW] beat() function
This commit is contained in:
13
mini.cpp
13
mini.cpp
@@ -88,6 +88,8 @@ int8_t pad_just_pressed = SDL_CONTROLLER_BUTTON_INVALID;
|
||||
Mix_Music *music = NULL;
|
||||
Mix_Chunk *sounds[MAX_SOUNDS];
|
||||
|
||||
int16_t beats, num_beats = 0;
|
||||
|
||||
char* get_value_from_line(char* line) {
|
||||
char* equal_character = strchr(line, '=');
|
||||
if (equal_character == NULL) return NULL;
|
||||
@@ -334,6 +336,8 @@ int main(int argc,char*argv[]){
|
||||
} else {
|
||||
loop();
|
||||
}
|
||||
if (beats==0)beats=num_beats;
|
||||
if (beats>0)beats--;
|
||||
key_just_pressed = 0;
|
||||
mouse_just_pressed = 0;
|
||||
pad_just_pressed = SDL_CONTROLLER_BUTTON_INVALID;
|
||||
@@ -943,6 +947,15 @@ float time() {
|
||||
return float(SDL_GetTicks())/1000.0f;
|
||||
}
|
||||
|
||||
bool beat(int16_t i) {
|
||||
if (i<0) {
|
||||
return beats==0;
|
||||
} else {
|
||||
beats=num_beats=i;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*float abs(float x) {
|
||||
return SDL_fabsf(x);
|
||||
}*/
|
||||
|
||||
Reference in New Issue
Block a user