Mouse Input

1.Overview

Mouse input is a core input device for gamers on desktop/laptop devices. Often time the mouse input are used in the browser alone and/or combined with keyboard and/input. Although the mice only has a few buttons its usage(as a mouse or even touchpad) can create some of the most ergonomic motions for smooth gameplay interactions. 

 

2.Mouse Functions

gpe.check_mouse_button_down(int mouseButtonId )

Returns true or false if the mouse button is being pressed now.

Scope: GPE

Return type : bool

Parameters:

  • int mouseButtonId – The constant assigned to the button. Also procecessed the nobutton and anybutton cases.

 

gpe.check_mouse_button_pressed(int mouseButtonId )

Returns true or false if the mouse buttonwas just pressed in frame.

Scope: GPE

Return type : bool

Parameters:

  • int mouseButtonId – The constant assigned to the button. Also procecessed the nobutton and anybutton cases.

 

gpe.check_mouse_button_released(int mouseButtonId )

Returns true or false if the mouse button was just released in frame.
Scope: GPE

Return type : bool

Parameters:

  • int mouseButtonId – The constant assigned to the button. Also procecessed the nobutton and anybutton cases.

 

3.Mouse constants

In GPE we utilize constants with the “mb_” prefix for handling mouse button input. It is important to know their importance when referencing buttons and their states throughout your games

Here is a complete list of the mb_ constants:

ConstantDescription
mb_anybuttonUsing this constant will cause mouse_checks to see if any button satisfies the called function.
mb_nobuttonUsing this constant will cause mouse_checks to see if all buttons do not satisfy the called function.
mb_leftThe left mouse button.
mb_rightThe right mouse button
mb_middleThe middle mouse button(often time the same as the mouse-wheel)
mb_centerThe middle mouse button(often time the same as the mouse-wheel)

4.Mouse Properties

GamePencil handles not just the button states of the mouse, but also its global (X, Y )  coordinates in the game as well as camera based mouse coordinates.

5.Examples

Take a peak of a basic point and click shooter example for using the mouse in GPE:

 

Suggest Edit