mirror of
https://github.com/Llennpie/Saturn.git
synced 2025-01-23 08:02:02 -05:00
Controllers work while window is unfocused
This commit is contained in:
parent
28e2b9d3b5
commit
2fb54dd347
3 changed files with 10 additions and 0 deletions
|
@ -99,6 +99,7 @@ bool configEditorAlwaysChroma = false;
|
||||||
bool configEditorExpressionPreviews = false;
|
bool configEditorExpressionPreviews = false;
|
||||||
unsigned int configFakeStarCount = 0;
|
unsigned int configFakeStarCount = 0;
|
||||||
bool configUnlockDoors = true;
|
bool configUnlockDoors = true;
|
||||||
|
bool configWindowState = false;
|
||||||
#ifdef BETTERCAMERA
|
#ifdef BETTERCAMERA
|
||||||
// BetterCamera settings
|
// BetterCamera settings
|
||||||
unsigned int configCameraXSens = 50;
|
unsigned int configCameraXSens = 50;
|
||||||
|
@ -170,6 +171,7 @@ static const struct ConfigOption options[] = {
|
||||||
{.name = "editor_preview_expressions", .type = CONFIG_TYPE_BOOL, .uintValue = &configEditorExpressionPreviews},
|
{.name = "editor_preview_expressions", .type = CONFIG_TYPE_BOOL, .uintValue = &configEditorExpressionPreviews},
|
||||||
{.name = "fake_star_count", .type = CONFIG_TYPE_UINT, .uintValue = &configFakeStarCount},
|
{.name = "fake_star_count", .type = CONFIG_TYPE_UINT, .uintValue = &configFakeStarCount},
|
||||||
{.name = "fake_unlock_doors", .type = CONFIG_TYPE_BOOL, .uintValue = &configUnlockDoors},
|
{.name = "fake_unlock_doors", .type = CONFIG_TYPE_BOOL, .uintValue = &configUnlockDoors},
|
||||||
|
{.name = "controller_works_unfocus", .type = CONFIG_TYPE_BOOL, .uintValue = &configWindowState},
|
||||||
#ifdef BETTERCAMERA
|
#ifdef BETTERCAMERA
|
||||||
{.name = "bettercam_enable", .type = CONFIG_TYPE_BOOL, .boolValue = &configEnableCamera},
|
{.name = "bettercam_enable", .type = CONFIG_TYPE_BOOL, .boolValue = &configEnableCamera},
|
||||||
{.name = "bettercam_analog", .type = CONFIG_TYPE_BOOL, .boolValue = &configCameraAnalog},
|
{.name = "bettercam_analog", .type = CONFIG_TYPE_BOOL, .boolValue = &configCameraAnalog},
|
||||||
|
|
|
@ -66,6 +66,7 @@ extern bool configEditorExpressionPreviews;
|
||||||
extern unsigned int configFakeStarCount;
|
extern unsigned int configFakeStarCount;
|
||||||
extern bool configUnlockDoors;
|
extern bool configUnlockDoors;
|
||||||
extern bool configEditorAlwaysChroma;
|
extern bool configEditorAlwaysChroma;
|
||||||
|
extern bool configWindowState;
|
||||||
#ifdef BETTERCAMERA
|
#ifdef BETTERCAMERA
|
||||||
extern unsigned int configCameraXSens;
|
extern unsigned int configCameraXSens;
|
||||||
extern unsigned int configCameraYSens;
|
extern unsigned int configCameraYSens;
|
||||||
|
|
|
@ -36,6 +36,10 @@ int windowWidth, windowHeight;
|
||||||
bool waitingForKeyPress;
|
bool waitingForKeyPress;
|
||||||
int fpsChoice;
|
int fpsChoice;
|
||||||
|
|
||||||
|
static void controller_active_unfocused() {
|
||||||
|
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, configWindowState?"1":"0");
|
||||||
|
}
|
||||||
|
|
||||||
const char* translate_bind_to_name(int bind) {
|
const char* translate_bind_to_name(int bind) {
|
||||||
static char name[11] = { 0 };
|
static char name[11] = { 0 };
|
||||||
sprintf(name, "%04X", bind);
|
sprintf(name, "%04X", bind);
|
||||||
|
@ -143,6 +147,7 @@ void ssettings_imgui_init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ssettings_imgui_update() {
|
void ssettings_imgui_update() {
|
||||||
|
controller_active_unfocused();
|
||||||
const char* mThemeSettings[] = { "Legacy", "Moon", "Half-Life", "Movie Maker", "Dear" };
|
const char* mThemeSettings[] = { "Legacy", "Moon", "Half-Life", "Movie Maker", "Dear" };
|
||||||
ImGui::PushItemWidth(150);
|
ImGui::PushItemWidth(150);
|
||||||
ImGui::Combo(ICON_FK_PAINT_BRUSH " Theme", (int*)&configEditorTheme, mThemeSettings, IM_ARRAYSIZE(mThemeSettings));
|
ImGui::Combo(ICON_FK_PAINT_BRUSH " Theme", (int*)&configEditorTheme, mThemeSettings, IM_ARRAYSIZE(mThemeSettings));
|
||||||
|
@ -289,6 +294,8 @@ void ssettings_imgui_update() {
|
||||||
//ImGui::PopItemWidth();
|
//ImGui::PopItemWidth();
|
||||||
ImGui::Checkbox("Unlock Doors", &configUnlockDoors);
|
ImGui::Checkbox("Unlock Doors", &configUnlockDoors);
|
||||||
imgui_bundled_tooltip("Unlocks all areas in the castle, regardless of save file.");
|
imgui_bundled_tooltip("Unlocks all areas in the castle, regardless of save file.");
|
||||||
|
ImGui::Checkbox("Read inputs while unfocused", &configWindowState);
|
||||||
|
imgui_bundled_tooltip("Reads controller inputs while the window is not focused.");
|
||||||
}
|
}
|
||||||
if (ImGui::CollapsingHeader("Editor###editor_settings")) {
|
if (ImGui::CollapsingHeader("Editor###editor_settings")) {
|
||||||
ImGui::Checkbox("Show tooltips", &configEditorShowTips);
|
ImGui::Checkbox("Show tooltips", &configEditorShowTips);
|
||||||
|
|
Loading…
Add table
Reference in a new issue