• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

How to make a touch screen

carmaniac

Where the pickle surprise at?
  • 675
    Posts
    16
    Years
    Well, this is for all of those people who keep asking how to make a touchscreen using crazyninjaguy's mouse module and dualscreen.
    Which I can't link the Mouse module as you have to find it over at planetdev.net.

    Well, for those who have his two scripts this is what you need to do.
    To make a menu have the mouse function you need to find the loop do of the script and then do this following script:

    Mouse.mouse_in_area?(x,y,width,height)

    That code there sets up the area of where the mouse is going to be expected.
    the x,y are the co-ordinates of where the area is located while the width and height is the area size.
    For example:

    Mouse.mouse_in_area?(30,30,100,100)

    That's an example of a button area for instance.
    The structure needed for the button to work would be this:

    Mouse.mouse_in_area?(30,30,100,100)
    if Mouse.click?(1)#left mouse button
    do stuff# This is where you put all of the commands you want to happen
    end # ends the check for the left mouse button being clicked
    end# ends the check for the mouse being in a certain area.


    Well that's all that's really needed to be known about the mouse script.
    I will only help those who make an effort to learn :P.
     
    Oh goodness! :D
    Thanks bro! I'll be trying my luck with this soon.. haha. :D
     
    Thanks for this.
    A question for this: Mouse.mouse_in_area?(x,y,width,height)
    Does width,height mean teh width and height from the Picture?

    Gigatom~
     
    Thanks for this.
    A question for this: Mouse.mouse_in_area?(x,y,width,height)
    Does width,height mean teh width and height from the Picture?

    Gigatom~

    Yes it does, sorry for not mentioning that but I will expand this page into more detail when I have time later on in the day.
     
    D: you have opened new things for the community, I can't believe you're handing them this.

    Now is this version 1, 2, or 3?
     
    D: you have opened new things for the community, I can't believe you're handing them this.

    Now is this version 1, 2, or 3?

    Shhh... Poeman XD. If I was giving the community something it would be this:
    An script base to making an touchscreen menu although I'm not revealing exactly how to call the script and keep it on the screen :P. That is for those determined game maker enthusiasts. And at the moment version 1.

    Code:
    class Window_Menu < SpriteWindow_Base
      def initialize
        @sprites = {}
        @sprites[""] = Sprite.new
        @sprites[""].x = 
        @sprites[""].y = 
        @sprites[""].z = 
        
      end
      def dispose
        
      end
      def refresh
        if Mouse.mouse_in_area?(x,y,width,height)
          if Mouse.click?(1)
            
          end
        end
        
      end
    end
     
    Who persuaded you to post this? but yes this would help game developers to make touch screen games. Thanks. :)
     
    Who persuaded you to post this? but yes this would help game developers to make touch screen games. Thanks. :)

    No one, I just felt like posting something like this seeming as only a few people knew how to do it.
     
    no that but do i make the co-ordinates the top left corner of the button?

    Ya from the top left corner of the very top screen which is (0,0), then lets say u want a button on the bottom screen 20 pixels from each part.
    sense there is a top screen and if you are using the spacer thing the start of the bottom screen will be (0,340)

    and to make the button 20 pixels apart use (20,360)
     
    Back
    Top