Skip to content

Commit

Permalink
Updating pkpy, seika, and removing 'audio wav sample rate' property (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Chukobyte authored Feb 13, 2025
1 parent fb0bdef commit d8a1e24
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 38 deletions.
4 changes: 2 additions & 2 deletions Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (NOT TARGET seika)
FetchContent_Declare(
seika_content
GIT_REPOSITORY https://github.com/Chukobyte/seika.git
GIT_TAG v0.2.3
GIT_TAG v0.2.16
)
FetchContent_MakeAvailable(seika_content)
endif ()
Expand All @@ -20,7 +20,7 @@ if (NOT TARGET pocketpy)
FetchContent_Declare(
pocketpy_content
GIT_REPOSITORY https://github.com/blueloveTH/pocketpy.git
GIT_TAG v2.0.1
GIT_TAG v2.0.3
)
FetchContent_MakeAvailable(pocketpy_content)
target_include_directories(pocketpy PUBLIC ${pocketpy_content_SOURCE_DIR} ${pocketpy_content_SOURCE_DIR}/include)
Expand Down
2 changes: 0 additions & 2 deletions editor/src/core/asset_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ void AssetManager::RefreshFromProperties(ProjectProperties* projectProperties) {
LoadFont(fontAsset.file_path.c_str(), fontAsset.uid.c_str(), fontAsset.size, fontAsset.applyNearestNeighbor);
}
}
// Set wav sample rate for audio system
ska_audio_set_wav_sample_rate(projectProperties->audioWavSampleRate);
}

// Texture
Expand Down
2 changes: 0 additions & 2 deletions editor/src/core/project_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ void ProjectProperties::LoadPropertiesFromConfig(const char* filePath) {
windowHeight = JsonHelper::Get<int>(propertyJson, "window_height");
resolutionWidth = JsonHelper::Get<int>(propertyJson, "resolution_width");
resolutionHeight = JsonHelper::Get<int>(propertyJson, "resolution_height");
audioWavSampleRate = JsonHelper::GetDefault<uint32_t>(propertyJson, "audio_wav_sample_rate", SKA_AUDIO_SOURCE_DEFAULT_WAV_SAMPLE_RATE);
maintainAspectRatio = JsonHelper::GetDefault<bool>(propertyJson, "maintain_aspect_ratio", false);
targetFPS = JsonHelper::Get<int>(propertyJson, "target_fps");
areCollidersVisible = JsonHelper::Get<bool>(propertyJson, "colliders_visible");
Expand Down Expand Up @@ -171,7 +170,6 @@ nlohmann::ordered_json ProjectProperties::ToJson() const {
configJson["resolution_width"] = resolutionWidth;
configJson["resolution_height"] = resolutionHeight;
configJson["maintain_aspect_ratio"] = maintainAspectRatio;
configJson["audio_wav_sample_rate"] = audioWavSampleRate;
configJson["target_fps"] = targetFPS;
configJson["initial_node_path"] = initialNodePath;
configJson["colliders_visible"] = areCollidersVisible;
Expand Down
1 change: 0 additions & 1 deletion editor/src/core/project_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class ProjectProperties : public Singleton<ProjectProperties> {
int32 windowHeight;
int32 resolutionWidth;
int32 resolutionHeight;
uint32 audioWavSampleRate = SKA_AUDIO_SOURCE_DEFAULT_WAV_SAMPLE_RATE;
bool maintainAspectRatio = false;
int32 targetFPS;
bool areCollidersVisible = false;
Expand Down
19 changes: 0 additions & 19 deletions editor/src/core/ui/views/opened_project/menu_bar_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,25 +175,6 @@ ImGuiHelper::MenuBar OpenedProjectUI::MenuBar::GetMenuBar() {
static ImGuiHelper::DragInt resolutionHeightInt("Resolution Height", projectProperties->resolutionHeight);
ImGuiHelper::BeginDragInt(resolutionHeightInt);

static std::string selectedAudioWavSampleRate = "";
static ImGuiHelper::ComboBox audioWavSampleRateComboBox(
"Audio Wav Sample Rate",
{ "44100", "48000" },
[](const char* newItem) {
selectedAudioWavSampleRate = newItem;
if (selectedAudioWavSampleRate == "44100") {
projectProperties->audioWavSampleRate = 44100;
} else if (selectedAudioWavSampleRate == "48000") {
projectProperties->audioWavSampleRate = 48000;
} else {
ska_logger_error("Unsupported audio wav sample rate '%s'", selectedAudioWavSampleRate.c_str());
}
// Update wav sample rate for audio system
ska_audio_set_wav_sample_rate(projectProperties->audioWavSampleRate);
}
);
ImGuiHelper::BeginComboBox(audioWavSampleRateComboBox);

static ImGuiHelper::CheckBox maintainAspectRatioCheckBox("Maintain Aspect Ratio", projectProperties->maintainAspectRatio);
ImGuiHelper::BeginCheckBox(maintainAspectRatioCheckBox);

Expand Down
2 changes: 1 addition & 1 deletion engine/src/core/core_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <seika/macro_utils.h>

#define CRE_VERSION_MAJOR 0
#define CRE_VERSION_MINOR 18
#define CRE_VERSION_MINOR 19
#define CRE_VERSION_PATCH 0

#define CRE_CORE_VERSION (SKA_MACRO_TO_STRING(CRE_VERSION_MAJOR) "." SKA_MACRO_TO_STRING(CRE_VERSION_MINOR) "." SKA_MACRO_TO_STRING(CRE_VERSION_PATCH))
1 change: 0 additions & 1 deletion engine/src/core/game_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ typedef struct CREGameProperties {
int32 windowWidth;
int32 windowHeight;
bool maintainAspectRatio;
uint32_t audioWavSampleRate;
int32 targetFPS;
char* initialScenePath;
bool areCollidersVisible;
Expand Down
3 changes: 0 additions & 3 deletions engine/src/core/json/json_file_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ CREGameProperties* cre_json_load_config_file(const char* filePath) {
// Maintain Aspect Ratio
properties->maintainAspectRatio = json_get_bool_default(configJson, "maintain_aspect_ratio", false);
ska_logger_debug("Maintain Aspect Ratio '%s'", properties->maintainAspectRatio == true ? "true" : "false");
// Wav Sample Rate
properties->audioWavSampleRate = json_get_int_default(configJson, "audio_wav_sample_rate", SKA_AUDIO_SOURCE_DEFAULT_WAV_SAMPLE_RATE);
ska_logger_debug("Wav Sample Rate '%u'", properties->audioWavSampleRate);
// Target FPS
properties->targetFPS = json_get_int(configJson, "target_fps");
ska_logger_debug("Target FPS '%d'", properties->targetFPS);
Expand Down
4 changes: 2 additions & 2 deletions engine/src/core/scripting/python/pocketpy/api/pkpy_api_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ bool cre_pkpy_api_audio_manager_play_sound(int argc, py_StackRef argv) {
const char* path = py_tostr(py_arg(0));
const bool loops = py_tobool(py_arg(1));

ska_audio_manager_play_sound(path, loops);
ska_audio_manager_play_sound2(path, loops);
py_newnone(py_retval());
return true;
}
Expand All @@ -900,7 +900,7 @@ bool cre_pkpy_api_audio_manager_stop_sound(int argc, py_StackRef argv) {
PY_CHECK_ARG_TYPE(0, tp_str);
const char* path = py_tostr(py_arg(0));

ska_audio_manager_stop_sound(path);
ska_audio_manager_stop_sound2(path);
py_newnone(py_retval());
return true;
}
Expand Down
10 changes: 5 additions & 5 deletions engine/src/core/tick.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ void cre_tick_update() {
const uint64 newTime = ska_get_ticks();
const uint64 deltaTime = newTime - mainTick.currentTime;
mainTick.currentTime = newTime;
// Handle variable update first
// Handle variable updates
const f32 deltaTimeSeconds = (f32)deltaTime / 1000.f;
mainTick.updateFunc(deltaTimeSeconds);
// Follow by fixed update
mainTick.accumulator += deltaTime;
// Handle fixed updates
mainTick.accumulator += (uint64)mainTick.fixedDeltaTime;
while (mainTick.accumulator >= mainTick.fixedUpdateInterval) {
mainTick.fixedUpdateFunc(deltaTimeSeconds);
mainTick.fixedUpdateFunc(mainTick.fixedDeltaTime);
mainTick.accumulator -= mainTick.fixedUpdateInterval;
}
// Last delay os based on target fps and frame time
// Apply delay to control frame rate based on target FPS
const uint64 frameTime = ska_get_ticks() - mainTick.currentTime;
if (frameTime < mainTick.updateInterval) {
ska_delay(mainTick.updateInterval - frameTime);
Expand Down

0 comments on commit d8a1e24

Please sign in to comment.