Module: MouseDocs

Included in:
GTK::Mouse
Defined in:
dragon/mouse_docs.rb

Overview

Copyright 2019 DragonRuby LLC MIT License mouse_docs.rb has been released under MIT (*only this file*).

Instance Method Summary collapse

Instance Method Details

#docs_classObject


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'dragon/mouse_docs.rb', line 7

def docs_class
<<-S
* DOCS: ~GTK::Mouse~

The mouse is accessible via ~args.inputs.mouse~:

#+begin_src ruby
def tick args
  # Rendering a label that shows the mouse's x and y position (via args.inputs.mouse).
  args.outputs.labels << [
    10,
    710,
    "The mouse's position is: \#{args.inputs.mouse.x} \#{args.inputs.mouse.y}."
  ]
end
#+end_src

The mouse has the following properties.

- ~args.inputs.mouse.x~: Returns the x position of the mouse.
- ~args.inputs.mouse.y~: Returns the y position of the mouse.
- ~args.inputs.mouse.moved~: Returns true if the mouse moved during the tick.
- ~args.inputs.mouse.moved_at~: Returns the tick_count (~args.state.tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move.
- ~args.inputs.mouse.global_moved_at~: Returns the global tick_count (~Kernel.global_tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move.
- ~args.inputs.mouse.click~: Returns a ~GTK::MousePoint~ for that specific frame (~args.state.tick_count~) if the mouse button was pressed.
- ~args.inputs.mouse.previous_click~: Returns a ~GTK::MousePoint~ for the previous frame (~args.state.tick_count - 1~) if the mouse button was pressed.
- ~args.inputs.mouse.up~: Returns true if for that specific frame (~args.state.tick_count~) if the mouse button was released.
- ~args.inputs.mouse.point~ | ~args.inputs.mouse.position~: Returns an ~Array~ which contains the ~x~ and ~y~ position of the mouse.
- ~args.inputs.mouse.has_focus~: Returns true if the game window has the mouse's focus.
- ~args.inputs.mouse.wheel~: Returns an ~GTK::OpenEntity~ that contains an ~x~ and ~y~ property which represents how much the wheel has moved. If the wheel has not moved within the tick, this property will be ~nil~.
- ~args.inputs.mouse.button_left~: Returns true if the left mouse button is down.
- ~args.inputs.mouse.button_right~: Returns true if the right mouse button is down.
- ~args.inputs.mouse.button_middle~: Returns true if the middle mouse button is down.
- ~args.inputs.mouse.button_bits~: Gives the bits for each mouse button and its current state.

* DOCS: ~GTK::MousePoint~

The ~GTK::MousePoint~ has the following properties.

- ~x~: Integer representing the mouse's x.
- ~y~: Integer representing the mouse's y.
- ~point~: Array with the ~x~ and ~y~ values.
- ~w~: Width of the point that always returns ~0~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).
- ~h~: Height of the point that always returns ~0~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).
- ~left~: This value is the same as ~x~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).
- ~right~: This value is the same as ~x~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).
- ~top~: This value is the same as ~y~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).
- ~bottom~: This value is the same as ~y~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).
- ~created_at~: The tick (~args.state.tick_count~) that this structure was created.
- ~global_created_at~: The global tick (~Kernel.global_tick_count~) that this structure was created.

S
end