Compare commits
6 Commits
dev-fc2a10
...
dev-1ffee9
Author | SHA1 | Date | |
---|---|---|---|
1ffee9933a | |||
aaa23194c5 | |||
013d1fef3b | |||
35026dfa0f | |||
2095bc6889 | |||
634bc92665 |
@ -38,6 +38,10 @@ if (TOMATO_ASAN)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# uggly, but it needs to be defined for all of tomato.
|
||||
# but this also means that we can not compile tomato in the same cmake as plugins
|
||||
add_compile_definitions(ENTT_API_EXPORT)
|
||||
|
||||
# external libs
|
||||
add_subdirectory(./external) # before increasing warn levels, sad :(
|
||||
|
||||
|
5
external/sdl/CMakeLists.txt
vendored
5
external/sdl/CMakeLists.txt
vendored
@ -10,7 +10,10 @@ if (NOT TARGET SDL3::SDL3)
|
||||
FetchContent_Declare(SDL3
|
||||
GIT_REPOSITORY https://github.com/libsdl-org/SDL
|
||||
#GIT_TAG 0429f5d6a36fc35b551bcc2acd4a40c2db6dab82 # tip when looking
|
||||
GIT_TAG 14f584a94bfd49cf1524db75bf3c419fdf9436cd # tip 26-04-2024
|
||||
#GIT_TAG 14f584a94bfd49cf1524db75bf3c419fdf9436cd # tip 26-04-2024
|
||||
GIT_TAG 06d6f2cb2518622593570985589700910cf4399f # 13-05-2024 - before
|
||||
# made changes that break imgui release 1.90.6
|
||||
#GIT_TAG 1103294d33f47ab4c697bb22a9cf27c79c658630 # tip 15-05-2024
|
||||
FIND_PACKAGE_ARGS # for the future
|
||||
)
|
||||
FetchContent_MakeAvailable(SDL3)
|
||||
|
3
external/sdl_image/CMakeLists.txt
vendored
3
external/sdl_image/CMakeLists.txt
vendored
@ -15,7 +15,8 @@ if (NOT TARGET SDL3_image::SDL3_image)
|
||||
FetchContent_Declare(SDL3_image
|
||||
GIT_REPOSITORY https://github.com/libsdl-org/SDL_image
|
||||
# waiting on the imgui pr to get merged so i can update sdl <.<
|
||||
GIT_TAG a45d6e5b84ccc0f3faae6ba7d561709ed600eee7 # tip last check
|
||||
#GIT_TAG a45d6e5b84ccc0f3faae6ba7d561709ed600eee7 # tip last check
|
||||
GIT_TAG a34ccf16f961e6d5a480045eb650fc3dddb4bfaa # tip 14-05-2024
|
||||
FIND_PACKAGE_ARGS # for the future
|
||||
)
|
||||
FetchContent_MakeAvailable(SDL3_image)
|
||||
|
2
external/solanaceae_plugin
vendored
2
external/solanaceae_plugin
vendored
Submodule external/solanaceae_plugin updated: 82cfb6d492...f7a519754d
16
flake.lock
generated
16
flake.lock
generated
@ -63,34 +63,34 @@
|
||||
"sdl3": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1714100414,
|
||||
"narHash": "sha256-eaiVG5WJoLnFvdpYBR+DF+YuMu5C3lA1SKuzN8+hfDM=",
|
||||
"lastModified": 1715616572,
|
||||
"narHash": "sha256-SCl7RbRThjci0xXUz9vmwDfqp0kenxEuuvoNlx6yiyU=",
|
||||
"owner": "libsdl-org",
|
||||
"repo": "SDL",
|
||||
"rev": "14f584a94bfd49cf1524db75bf3c419fdf9436cd",
|
||||
"rev": "06d6f2cb2518622593570985589700910cf4399f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "libsdl-org",
|
||||
"repo": "SDL",
|
||||
"rev": "14f584a94bfd49cf1524db75bf3c419fdf9436cd",
|
||||
"rev": "06d6f2cb2518622593570985589700910cf4399f",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"sdl3_image": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1712700609,
|
||||
"narHash": "sha256-PVPH1uJ6g65SzHUboeQE6ZkC+72doMz9t9SG2LBo+7I=",
|
||||
"lastModified": 1715708273,
|
||||
"narHash": "sha256-scNPhzGk+d8VqkOKsSxmH/OVLgkWrOkEeWn/b2f3XaU=",
|
||||
"owner": "libsdl-org",
|
||||
"repo": "SDL_image",
|
||||
"rev": "a45d6e5b84ccc0f3faae6ba7d561709ed600eee7",
|
||||
"rev": "a34ccf16f961e6d5a480045eb650fc3dddb4bfaa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "libsdl-org",
|
||||
"repo": "SDL_image",
|
||||
"rev": "a45d6e5b84ccc0f3faae6ba7d561709ed600eee7",
|
||||
"rev": "a34ccf16f961e6d5a480045eb650fc3dddb4bfaa",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
|
@ -11,11 +11,11 @@
|
||||
flake = false;
|
||||
};
|
||||
sdl3 = {
|
||||
url = "github:libsdl-org/SDL/14f584a94bfd49cf1524db75bf3c419fdf9436cd"; # keep in sync this cmake
|
||||
url = "github:libsdl-org/SDL/06d6f2cb2518622593570985589700910cf4399f"; # keep in sync this cmake
|
||||
flake = false;
|
||||
};
|
||||
sdl3_image = {
|
||||
url = "github:libsdl-org/SDL_image/a45d6e5b84ccc0f3faae6ba7d561709ed600eee7";
|
||||
url = "github:libsdl-org/SDL_image/a34ccf16f961e6d5a480045eb650fc3dddb4bfaa";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
@ -105,3 +105,8 @@ target_link_libraries(tomato PUBLIC
|
||||
SDL3_image::SDL3_image
|
||||
)
|
||||
|
||||
# probably not enough
|
||||
#target_compile_definitions(tomato PUBLIC ENTT_API_EXPORT)
|
||||
|
||||
set_target_properties(tomato PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
|
@ -73,15 +73,56 @@ MainScreen::MainScreen(SDL_Renderer* renderer_, Theme& theme_, std::string save_
|
||||
// TODO: pm?
|
||||
|
||||
// graphics
|
||||
g_provideInstance("ImGuiContext", ImGui::GetVersion(), "host", ImGui::GetCurrentContext());
|
||||
g_provideInstance<ImGuiContext>("ImGuiContext", ImGui::GetVersion(), "host", ImGui::GetCurrentContext());
|
||||
{
|
||||
ImGuiMemAllocFunc alloc_func = nullptr;
|
||||
ImGuiMemFreeFunc free_func = nullptr;
|
||||
void* user_data = nullptr;
|
||||
ImGui::GetAllocatorFunctions(&alloc_func, &free_func, &user_data);
|
||||
|
||||
// function pointers are funky
|
||||
g_provideInstance("ImGuiMemAllocFunc", ImGui::GetVersion(), "host", reinterpret_cast<void*>(alloc_func));
|
||||
g_provideInstance("ImGuiMemFreeFunc", ImGui::GetVersion(), "host", reinterpret_cast<void*>(free_func));
|
||||
if (user_data != nullptr) { // dont register nullptrs (can be valid, we rely on the other 2 pointers to indicate)
|
||||
g_provideInstance("ImGuiMemUserData", ImGui::GetVersion(), "host", user_data);
|
||||
}
|
||||
}
|
||||
|
||||
g_provideInstance<TextureUploaderI>("TextureUploaderI", "host", &sdlrtu);
|
||||
}
|
||||
|
||||
for (const auto& ppath : plugins) {
|
||||
if (!pm.add(ppath)) {
|
||||
std::cerr << "MS error: loading plugin '" << ppath << "' failed!\n";
|
||||
|
||||
// thow?
|
||||
assert(false && "failed to load plugin");
|
||||
//assert(false && "failed to load plugin");
|
||||
SDL_MessageBoxData mb;
|
||||
mb.flags = SDL_MESSAGEBOX_ERROR;
|
||||
mb.window = nullptr;
|
||||
mb.title = "Tomato failed to load a plugin!";
|
||||
std::string message {"Failed to load plugin '"};
|
||||
message += ppath;
|
||||
message += "' !";
|
||||
mb.message = message.c_str();
|
||||
|
||||
mb.numbuttons = 2;
|
||||
SDL_MessageBoxButtonData mb_buttons[2] {};
|
||||
mb_buttons[0].buttonID = 1;
|
||||
mb_buttons[0].flags = SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT;
|
||||
mb_buttons[0].text = "Abort";
|
||||
mb_buttons[1].buttonID = 2;
|
||||
mb_buttons[1].flags = SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT;
|
||||
mb_buttons[1].text = "Continue Anyway";
|
||||
mb.buttons = mb_buttons;
|
||||
|
||||
mb.colorScheme = nullptr;
|
||||
|
||||
int button_id = 0;
|
||||
SDL_ShowMessageBox(&mb, &button_id);
|
||||
if (button_id == 1) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user