1 registered members (AndrewAMD),
1,306
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: TUST or "The community library"
[Re: sivan]
#426933
07/31/13 14:00
07/31/13 14:00
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
OP
Expert
|
OP
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
I've built another feature: Input Manager It allows users to built a Unity-alike input system with multiple key bindings and so on... Init-Code:
input_init(); // Initialize the input system
// Setup axis controls
input_set_buttons("forward", key_for_str("w"), key_for_str("s"));
input_set_axis("forward", key_force.y, 1, 0.01);
input_set_buttons("sideward", key_for_str("a"), key_for_str("d"));
input_set_axis("sideward", key_force.x, -1, 0.01); // Invert X-Axis to get proper left-right movement
// Three simple buttons for movement
input_set_button("jump", key_for_str("space"));
input_set_button("crouch", 29); // ctrl
input_set_button("sprint", key_for_str("shiftl"));
Usage:
var inputValue = input_get("forward");
In the example above, inputValue is influenced by key_w, key_s and key_force.y. key_w increases , key_s decreases and key_force.y is added to the value. So eg. controlling a player would be possible with wasd and key_force without any additional programming or changes required.
|
|
|
Re: TUST or "The community library"
[Re: MasterQ32]
#426951
07/31/13 14:56
07/31/13 14:56
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
@MasterQ32 looks nice BUT please for the sake of Performance, use Constant IDs and NOT strings o.O Something like:
//complete nonsense order for demonstration, only
int CInput_Forward = 0;
int CInput_Jump = 1;
...
input_set_buttons(CInput_Forward, key_for_str("w"), key_for_str("s"));
...
var inputValue = input_get(CInput_Forward);
Use strings where you need to display something, otherwhise use IDs
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Re: TUST or "The community library"
[Re: MasterQ32]
#426955
07/31/13 15:36
07/31/13 15:36
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
Then you need Constant-Strings In these cases you just avoid to write them inline.
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Re: TUST or "The community library"
[Re: lemming]
#427115
08/02/13 11:08
08/02/13 11:08
|
Joined: Mar 2006
Posts: 1,993 Karlsruhe
PadMalcom
Serious User
|
Serious User
Joined: Mar 2006
Posts: 1,993
Karlsruhe
|
@Lemming thanks! Here is - next to voronoi - another algorithm to create road networks: Quadtrees! (Still a little buggy.)
Last edited by PadMalcom; 08/02/13 11:08.
|
|
|
|