1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

Extension Virtual Keypad for your game!

Discussion in 'Tutorials' started by Rafsun82, Dec 14, 2016.

  1. Rafsun82

    Rafsun82 Guest

    Virtual Keypad
    by r82

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

    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.


    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.

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

    - 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.

    - 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.

    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.

    Please leave your feedback, what improvement you want as an update, which codes need to be fixed etc. Thanks.
    SilentxxBunny and Gai Daigoji like this.
  2. chance

    chance predictably random Forum Staff Moderator

    Apr 22, 2016
    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.
  3. Rafsun82

    Rafsun82 Guest

    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. : )

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice