summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2025-01-16 18:41:36 -0500
committerJonathan Bradley <jcb@pikum.xyz>2025-01-16 18:41:36 -0500
commit846a6e1185417ee3e187edc06ef327d180bf0d9b (patch)
treec372f0dbe0d12361acd5ef60c082679a1651d863 /editor
parent15524958f409b1f13a1deffc4dd8c1fbddefaf28 (diff)
pke: add font asset type
Diffstat (limited to 'editor')
-rw-r--r--editor/editor.cpp8
1 files changed, 7 insertions, 1 deletions
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<AssetType_T>(PKE_ASSET_TYPE_AUDIO));
type = PKE_ASSET_TYPE_AUDIO;
}
+ if (ImGui::CheckboxFlags("Font", &assetTypeMask, 1U << static_cast<AssetType_T>(PKE_ASSET_TYPE_FONT))) {
+ assetTypeMask = assetTypeMask & (1U << static_cast<AssetType_T>(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();