diff options
| author | swurl <swurl@swurl.xyz> | 2025-05-31 02:33:02 -0400 |
|---|---|---|
| committer | swurl <swurl@swurl.xyz> | 2025-05-31 02:33:02 -0400 |
| commit | 6c655321e6b04b8648802e296bb5ca11d290ae68 (patch) | |
| tree | 5c906511e4a2910ce8b806bb9d763b524c28619e /externals/oboe/samples/RhythmGame/src/main/cpp/GameConstants.h | |
| parent | c0cceff365f754f8859f4c9a0362ebdba7ea388b (diff) | |
Move dead submodules in-tree
Signed-off-by: swurl <swurl@swurl.xyz>
Diffstat (limited to 'externals/oboe/samples/RhythmGame/src/main/cpp/GameConstants.h')
| -rw-r--r-- | externals/oboe/samples/RhythmGame/src/main/cpp/GameConstants.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/externals/oboe/samples/RhythmGame/src/main/cpp/GameConstants.h b/externals/oboe/samples/RhythmGame/src/main/cpp/GameConstants.h new file mode 100644 index 0000000000..288159279e --- /dev/null +++ b/externals/oboe/samples/RhythmGame/src/main/cpp/GameConstants.h @@ -0,0 +1,60 @@ +/* + * Copyright 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SAMPLES_GAMECONSTANTS_H +#define SAMPLES_GAMECONSTANTS_H + +#include "ui/OpenGLFunctions.h" + +constexpr int kBufferSizeInBursts = 2; // Use 2 bursts as the buffer size (double buffer) +constexpr int kMaxQueueItems = 4; // Must be power of 2 + +// Colors for game states and visual feedback for taps +constexpr ScreenColor kPlayingColor = GREY; +constexpr ScreenColor kLoadingColor = YELLOW; +constexpr ScreenColor kLoadingFailedColor = RED; +constexpr ScreenColor kTapSuccessColor = GREEN; +constexpr ScreenColor kTapEarlyColor = ORANGE; +constexpr ScreenColor kTapLateColor = PURPLE; + +// This defines the size of the tap window in milliseconds. For example, if defined at 100ms the +// player will have 100ms before and after the centre of the tap window to tap on the screen and +// be successful +constexpr int kWindowCenterOffsetMs = 100; + +// Filename for clap sound asset (in assets folder) +constexpr char kClapFilename[] { "CLAP.mp3" }; + +// Filename for the backing track asset (in assets folder) +constexpr char kBackingTrackFilename[] { "FUNKY_HOUSE.mp3" }; + +// The game will first demonstrate the pattern which the user should copy. It does this by +// "clapping" (playing a clap sound) at certain times during the song. We can specify these times +// here in milliseconds. Our backing track has a tempo of 120 beats per minute, which is 2 beats per +// second. This means a pattern of 3 claps starting on the first beat of the first bar would mean +// playing claps at 0ms, 500ms and 1000ms +constexpr int64_t kClapEvents[] { 0, 500, 1000 }; + +// We then want the user to tap on the screen exactly 4 beats after the first clap so we add clap +// windows at 2000ms, 2500ms and 3000ms (or 2, 2.5 and 3 seconds). @see getTapResult for more info. +constexpr int64_t kClapWindows[] { 2000, 2500, 3000 }; + +struct AudioProperties { + int32_t channelCount; + int32_t sampleRate; +}; + +#endif //SAMPLES_GAMECONSTANTS_H |
