From 846a6e1185417ee3e187edc06ef327d180bf0d9b Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Thu, 16 Jan 2025 18:41:36 -0500 Subject: pke: add font asset type --- editor/editor.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'editor') diff --git a/editor/editor.cpp b/editor/editor.cpp index e67ee12..a15c838 100644 --- a/editor/editor.cpp +++ b/editor/editor.cpp @@ -483,7 +483,8 @@ void RecordImGui_AssetPicker(AssetPickerSearchStruct &apss) { for (pk_handle_item_index_T i = 0; i < iCount; ++i) { const Asset &a = assets[i]; assetLabel &al = assetEntries.Push(); - memcpy(al.key, a.key, AssetKeyLength); + strncpy(al.key, a.key, AssetKeyLength); + al.key[AssetKeyLength-1] = '\0'; al.handle = a.handle; al.type = a.type; } @@ -538,6 +539,10 @@ void RecordImGuiModalCreateAsset() { assetTypeMask = assetTypeMask & (1U << static_cast(PKE_ASSET_TYPE_AUDIO)); type = PKE_ASSET_TYPE_AUDIO; } + if (ImGui::CheckboxFlags("Font", &assetTypeMask, 1U << static_cast(PKE_ASSET_TYPE_FONT))) { + assetTypeMask = assetTypeMask & (1U << static_cast(PKE_ASSET_TYPE_FONT)); + type = PKE_ASSET_TYPE_FONT; + } if (ImGui::Button("Select File")) { const char * patterns[1] = {"*.*"}; @@ -556,6 +561,7 @@ void RecordImGuiModalCreateAsset() { if (ImGui::Button("Create")) { AM_Register(assetKey, type, assetPath); shouldRebuildAssetList = true; + assetEntries.Resize(0); shouldClose = true; } ImGui::SameLine(); -- cgit v1.2.3