Virtual Keypad for your game!

R

Rafsun82

Guest
Virtual Keypad
by r82


GM Version:
GM8 and GM:S
Target Platform: ALL
Download: Download from Dropbox (*.zip)
Links: N/A

Summary:
Sometimes you may wanted to use a virtual keypad in your game, specially for touch devices. This tutorial shows you how to display a virtual keypad on the screen that receives input by mouse click or touch and can be fully customized and resized.

Preview:


Resources:
For this purpose, I have written a bunch of codes and exported them as external resources, scripts and objects (included in the download link). These resources are all you need for adding a virtual keypad in your project.

Features
- Custom keypad size.
- Custom keypad theme\skin.
- Allows sprites to use as button texture.
- Easy to use.

Limitations
- Sometimes a little bit slow in interacting with touch devices.
- It is not a built-in system keypad but made with GameMaker's object and drawing engine.

Terms
- You can use these resources for free (also free for commercial project) and credit appreciated but not mandatory.
- You won't sell or publish them without permission.

Tutorial:
First, You just need to import resources like an extension in your project. Then, simply call some scripts and the keypad will start working like a charm!

If you are using GameMaker: Studio, then import "r82_obj_keypad_handle.object.gmx" and "r82_obj_keypad_button.object.gmx". For GameMaker 8, import "r82_virtual_keypad_objects.gmres". These are two objects that made for the keypad to work.
Then, import "r82_virtual_keypad_scripts.gml" in your project. These are scripts to control those two objects you have imported before.
You don't need to put those objects in the room. Leave them alone.

Must call "r82_keypad_init()" before calling any other "r82_keypad_*" functions.
Call "r82_keypad_show()" to show the keypad on the screen and "r82_keypad_hide()" to hide.
After calling "r82_keypad_show()", each and every inputs will be recorded and can be accessed by "r82_keypad_string()". You can also insert and clear string from the record by "r82_keypad_string_insert(string)" and "r82_keypad_string_clear()".
Now let's talk about theme. Open the "r82_keypad_theme" script in your project. There it's documented how to modify it.

There is also an example project "example.gmk" in the download link. That shows all described above. But don't forgot to import scripts and objects (said about it on the second para) in that example project before compile it.

Conclusion:
Please leave your feedback, what improvement you want as an update, which codes need to be fixed etc. Thanks.
 

chance

predictably random
Forum Staff
Moderator
I approve your topic, but the download files are incomplete. Only the gmx project, without the resource folders, was contained in the zip. I was able to import the gmk (GM8) file into Studio, but there were compatibility errors. But at least the gml notepad file was OK.

As soon as you can, please replace those with regular gmz Studio archives. That's your best bet to reach a wide audience.
 
R

Rafsun82

Guest
@chance
Those *.gmx files are objects. Actually *.object.gmx file. These two objects (two *.object.gmx files) are to be imported. Here the whole project isn't necessary. : )
 
Top