• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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?
671
Posts
15
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.
 

Orangturttle

Magikarp MASTER!
44
Posts
13
Years
  • Seen Oct 23, 2012
Oh goodness! :D
Thanks bro! I'll be trying my luck with this soon.. haha. :D
 

Gigatom~

Pokemon Ruthenium Creator ~
117
Posts
14
Years
  • Age 28
  • Seen May 25, 2012
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~
 

carmaniac

Where the pickle surprise at?
671
Posts
15
Years
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.
 

Poeman

Banned
755
Posts
15
Years
  • Age 29
  • Seen Nov 1, 2012
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?
 

carmaniac

Where the pickle surprise at?
671
Posts
15
Years
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
 

carmaniac

Where the pickle surprise at?
671
Posts
15
Years
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.
 

zingzags

PokemonGDX creator
536
Posts
15
Years
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)
 

Yuoaman

I don't know who I am either.
4,582
Posts
18
Years
Please try to refrain from posting in topics that have not had replies in over two months from now on, Urugamosu.

Closed.
 
Back
Top