-
-
Notifications
You must be signed in to change notification settings - Fork 102
Steam Input API core support #1695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 7 commits
9c723da
6859ab8
0a13193
d6d88e9
57e5cbd
c82ecbe
af30273
bf5482d
36f75cb
645f108
86e0406
7a1034c
db87ec2
993a7ef
6488141
26619b9
9b13b63
32c6e9e
cff5332
ffbbac3
2e7aa7f
dcb8364
5d08d26
f152889
5d3c690
dcf7932
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| "In Game Actions" | ||
| { | ||
| "actions" | ||
| { | ||
| "InGameControls" | ||
| { | ||
| "title" "#Set_Ingame" | ||
| "StickPadGyro" | ||
| { | ||
| "move" | ||
| { | ||
| "title" "#Action_Move" | ||
| "input_mode" "joystick_move" | ||
| } | ||
| "camera" | ||
| { | ||
| "title" "#Action_Camera" | ||
| "input_mode" "absolute_mouse" | ||
| } | ||
| } | ||
| "Button" | ||
| { | ||
| "primary" "#Action_Primary" | ||
| "secondary" "#Action_Secondary" | ||
| "reload" "#Action_Reload" | ||
| "use" "#Action_Use" | ||
| "jump" "#Action_Jump" | ||
| "walk" "#Action_Walk" | ||
| "crouch" "#Action_Crouch" | ||
| "special" "#Action_Special" | ||
| "drop" "#Action_Drop" | ||
| "affinity" "#Action_Affinity" | ||
| "dash" "#Action_Dash" | ||
|
|
||
| "next_weapon" "#Action_NextWeapon" | ||
| "previous_weapon" "#Action_PreviousWeapon" | ||
| "primary_weapon" "#Action_PrimaryWeapon" | ||
| "secondary_weapon" "#Action_SecondaryWeapon" | ||
| "wheel_select" "#Action_WheelSelect" | ||
| "change_loadout" "#Action_ChangeLoadout" | ||
|
|
||
| "scoreboard" "#Action_Scoreboard" | ||
| "suicide" "#Action_Suicide" | ||
| "menu" "#Action_Menu" | ||
|
|
||
| "recenter_camera" "#Action_RecenterCamera" | ||
|
|
||
| } | ||
| } | ||
| "MenuControls" | ||
| { | ||
| "title" "#Set_Menu" | ||
| "StickPadGyro" | ||
| { | ||
| } | ||
| "AnalogTrigger" | ||
| { | ||
| } | ||
| "Button" | ||
| { | ||
| "menu_up" "#Menu_Up" | ||
| "menu_down" "#Menu_Down" | ||
| "menu_left" "#Menu_Left" | ||
| "menu_right" "#Menu_Right" | ||
| "menu_select" "#Menu_Select" | ||
| "menu_cancel" "#Menu_Cancel" | ||
| "pause_menu" "#Action_ReturnToGame" | ||
| } | ||
| } | ||
| } | ||
| "localization" | ||
| { | ||
| "english" | ||
| { | ||
| "Set_Ingame" "In-Game Controls" | ||
| "Set_Menu" "Menu Controls" | ||
| "Action_Move" "Move" | ||
| "Action_Camera" "Camera" | ||
| "Action_Primary" "Primary Fire" | ||
| "Action_Secondary" "Secondary Fire" | ||
| "Action_Reload" "Reload" | ||
| "Action_Use" "Use/Pick Up" | ||
| "Action_Jump" "Jump" | ||
| "Action_Walk" "Walk" | ||
| "Action_Crouch" "Crouch" | ||
| "Action_Special" "Special" | ||
| "Action_Drop" "Drop Weapon" | ||
| "Action_Affinity" "Drop Affinity" | ||
| "Action_Dash" "Dash" | ||
| "Action_NextWeapon" "Next Weapon" | ||
| "Action_PreviousWeapon" "Previous Weapon" | ||
| "Action_PrimaryWeapon" "Primary Weapon" | ||
| "Action_SecondaryWeapon" "Secondary Weapon" | ||
| "Action_WheelSelect" "Wheel Select" | ||
| "Action_ChangeLoadout" "Change Loadout" | ||
| "Action_Scoreboard" "Scoreboard" | ||
| "Action_Suicide" "Suicide" | ||
| "Action_Menu" "Menu" | ||
|
|
||
| "Action_RecenterCamera" "Recenter Camera" | ||
|
|
||
| "Menu_Up" "Up" | ||
| "Menu_Down" "Down" | ||
| "Menu_Left" "Left" | ||
| "Menu_Right" "Right" | ||
| "Menu_Select" "Select" | ||
| "Menu_Cancel" "Cancel" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,28 @@ keymap -13 MOUSE13 | |
| keymap -14 MOUSE14 | ||
| keymap -15 MOUSE15 | ||
| keymap -16 MOUSE16 | ||
| // Steam Input API controller actions | ||
| keymap -20 SIAPI_PRIMARY | ||
| keymap -21 SIAPI_SECONDARY | ||
| keymap -22 SIAPI_RELOAD | ||
| keymap -23 SIAPI_USE | ||
| keymap -24 SIAPI_JUMP | ||
| keymap -25 SIAPI_WALK | ||
| keymap -26 SIAPI_CROUCH | ||
| keymap -27 SIAPI_SPECIAL | ||
| keymap -28 SIAPI_DROP | ||
| keymap -29 SIAPI_AFFINITY | ||
| keymap -30 SIAPI_DASH | ||
| keymap -31 SIAPI_NEXT_WEAPON | ||
| keymap -32 SIAPI_PREVIOUS_WEAPON | ||
| keymap -33 SIAPI_PRIMARY_WEAPON | ||
| keymap -34 SIAPI_SECONDARY_WEAPON | ||
| keymap -35 SIAPI_WHEEL_SELECT | ||
| keymap -36 SIAPI_CHANGE_LOADOUT | ||
| keymap -37 SIAPI_SCOREBOARD | ||
| keymap -38 SIAPI_SUICIDE | ||
| keymap -39 SIAPI_MENU | ||
|
||
|
|
||
| keymap 8 BACKSPACE | ||
| keymap 9 TAB | ||
| keymap 13 RETURN | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,6 +131,32 @@ bind K [ suicide ] | |
|
|
||
| bind TAB [ showscores ] | ||
|
|
||
| // Steam Input controller binds; these actions _should not be rebound_ - do it | ||
| // through the Steam Input configuration interface | ||
| bind SIAPI_PRIMARY [ primary ] | ||
| specbind SIAPI_PRIMARY [ spectate 0 ] | ||
| bind SIAPI_SECONDARY [ secondary ] | ||
| specbind SIAPI_SECONDARY [ spectate 0 ] | ||
| bind SIAPI_WHEEL_SELECT [ game_hud_piemenu_open_weapsel_key ] // Currently broken | ||
| bind SIAPI_NEXT_WEAPON [ universaldelta 1 ] | ||
| bind SIAPI_PREVIOUS_WEAPON [ universaldelta -1 ] | ||
| bind SIAPI_PRIMARY_WEAPON [ weapon (weapload 0) 1 ] | ||
| bind SIAPI_SECONDARY_WEAPON [ weapon (weapload 1) 1 ] | ||
| bind SIAPI_MENU [ uitoggle ] | ||
| bind SIAPI_JUMP [ jump ] | ||
| specbind SIAPI_JUMP [ specmodeswitch ] | ||
| bind SIAPI_SPECIAL [ special ] | ||
| bind SIAPI_CROUCH [ crouch ] | ||
| bind SIAPI_USE [ use ] | ||
| specbind SIAPI_USE [ spectate 0 ] | ||
| bind SIAPI_RELOAD [ reload ] | ||
| specbind SIAPI_RELOAD [ specmodeswitch ] | ||
| bind SIAPI_DROP [ drop ] | ||
| bind SIAPI_AFFINITY [ affinity ] | ||
| bind SIAPI_SCOREBOARD [ showscores ] | ||
| bind SIAPI_CHANGE_LOADOUT [ gameui_player_show_loadout ] | ||
| bind SIAPI_SUICIDE [ suicide ] | ||
|
|
||
|
Comment on lines
+134
to
+176
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bind the SIAPI actions. You are not supposed to rebind these actions in-engine; you are intended to use the Steam Input configurator tool and change things there. |
||
| saytextcolour = 0; setpersist saytextcolour 1; setcomplete saytextcolour 1 | ||
| getsaycolour = [ | ||
| sc = $saytextcolour | ||
|
|
||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Settings menu item for glyph prompts. 'Automatic' is probably what most people want (dynamically changes glyphs based on last input), but - as is considered good practice - there are options to explicitly lock glyphs if needed. Because Steam Input handles different hardware types for us, the only glyph distinction we need make is KB/M vs controller. This is technically an interface thing, but I feel like it makes more sense to have it together with the controls options. KNOWN ISSUE 1: The box for this is weirdly not as wide as the other boxes in the menu. I probably copied a setting I didn't intend. It may not be worth fiddling with this much because I still need to add a button to open up the controller configurator interface provided by Steam. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,13 @@ | ||
| #include "rendertext.h" | ||
| #include "engine.h" | ||
| #include "controller.h" | ||
|
|
||
| enum textkeyimagetype { | ||
| tkip_automatic, // Figure out which glyphs to show based on last input | ||
| tkip_kbm, // Always show keyboard/mouse glyphs | ||
| tkip_controller, // Always show controller glyphs | ||
| tkip_both, // Always show *both* keyboard/mouse and controller glyphs | ||
| }; | ||
|
|
||
| VARF(IDF_PERSIST, textsupersample, 0, 1, 2, initwarning("Text Supersampling", INIT_LOAD, CHANGE_SHADERS)); | ||
|
|
||
|
|
@@ -14,6 +23,7 @@ FVAR(IDF_PERSIST, textspacescale, 0, 0.5f, 10); | |
|
|
||
| FVAR(IDF_PERSIST, textimagescale, 0, 0.8f, FVAR_MAX); | ||
| VAR(IDF_PERSIST, textkeyimages, 0, 1, 1); | ||
| VAR(IDF_PERSIST, textkeyimagepreference, tkip_automatic, tkip_automatic, tkip_both); | ||
| FVAR(IDF_PERSIST, textkeyimagescale, 0, 0.8f, FVAR_MAX); | ||
| SVAR(IDF_PERSIST, textkeyprefix, "<invert>textures/keys/"); | ||
| VAR(IDF_PERSIST, textkeyseps, 0, 1, 1); | ||
|
|
@@ -34,6 +44,21 @@ font *curfont = NULL; | |
| int curfontpass = 0; | ||
| bool wantfontpass = false; | ||
|
|
||
| bool shouldkeepkey(const char *str) | ||
| { | ||
| bool is_siapi_textkey = controller::is_siapi_textkey(str); | ||
| switch (textkeyimagepreference) { | ||
| case tkip_automatic: | ||
| return controller::lastinputwassiapi ? is_siapi_textkey : !is_siapi_textkey; | ||
| case tkip_kbm: | ||
| return !is_siapi_textkey; | ||
| case tkip_controller: | ||
| return is_siapi_textkey; | ||
| case tkip_both: | ||
| return true; | ||
| }; | ||
| } | ||
|
|
||
|
Comment on lines
+47
to
+61
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pursuant to above variable, there is now support in the textkey system to filter out glyphs |
||
| void fontscale(float *scale) | ||
| { | ||
| if(!fontdef) return; | ||
|
|
@@ -742,22 +767,12 @@ void text_boundsf(const char *str, float &width, float &height, float xpad, floa | |
| #undef TEXTCHAR | ||
| } | ||
|
|
||
| struct textkey | ||
| { | ||
| char *name, *file; | ||
| Texture *tex; | ||
| textkey() : name(NULL), file(NULL), tex(NULL) {} | ||
| textkey(char *n, char *f, Texture *t) : name(newstring(n)), file(newstring(f)), tex(t) {} | ||
| ~textkey() | ||
| { | ||
| DELETEA(name); | ||
| DELETEA(file); | ||
| } | ||
| }; | ||
|
Comment on lines
-745
to
-756
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This moved to |
||
| vector<textkey *> textkeys; | ||
|
|
||
| textkey *findtextkey(const char *str) | ||
| { | ||
| // SIAPI actions have special handling because we can't cache them | ||
| if(controller::is_siapi_textkey(str)) return controller::get_siapi_textkey(str); | ||
| loopv(textkeys) if(!strcmp(textkeys[i]->name, str)) return textkeys[i]; | ||
| static string key; | ||
| copystring(key, textkeyprefix); | ||
|
|
@@ -819,9 +834,15 @@ float key_widthf(const char *str) | |
| vector<char *> list; | ||
| explodelist(keyn, list); | ||
| float width = 0, scale = curfont->scale*curtextscale*textkeyimagescale; | ||
| int skippedkeys = 0; | ||
| loopv(list) | ||
| { | ||
| if(i && textkeyseps) width += text_widthf(" or "); | ||
| if(!shouldkeepkey(list[i])) | ||
| { | ||
| skippedkeys++; | ||
| continue; | ||
| } | ||
| if(i && i > skippedkeys && textkeyseps) width += text_widthf(" or "); | ||
| if(textkeyimages) | ||
| { | ||
| textkey *t = findtextkey(list[i]); | ||
|
|
@@ -847,9 +868,15 @@ static float draw_key(Texture *&tex, const char *str, float sx, float sy, bvec4 | |
| vector<char *> list; | ||
| explodelist(keyn, list); | ||
| float width = 0; | ||
| int skippedkeys = 0; | ||
| loopv(list) | ||
| { | ||
| if(i && textkeyseps) | ||
| if(!shouldkeepkey(list[i])) | ||
| { | ||
| skippedkeys++; | ||
| continue; | ||
| } | ||
| if(i && i > skippedkeys && textkeyseps) | ||
| { | ||
| if(!curfontpass) | ||
| { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.