Top Level Namespace

Includes:
Gamebox, Gosu

Defined Under Namespace

Modules: AABBNodeDebugHelpers, AABBTreeDebugHelpers, Arbiter, ClassFinder, Conject, DebugHelpers, Gamebox, GameboxAcceptanceSpecHelpers, GameboxDSL, GameboxSpecHelpers, GosuWindowAPI, Inflector, Math, MinMaxHelpers, ObservableAttributes, PostSetupHandlers, Publisher, TestStageHelpers Classes: AABBNode, AABBTree, AabbCollidable, Actor, ActorDefinition, ActorFactory, ActorView, ActorViewDefinition, ActorViewFactory, Array, Backstage, Behavior, BehaviorDefinition, BehaviorFactory, CircleCollidable, CodeStatistics, CollidableShape, ConfigManager, Director, EventedStub, FontStyle, FontStyleFactory, Game, GameboxApp, Hash, HookedGosuWindow, InputManager, InputMapper, LinkedList, MethodMissingCollector, MockFont, MockGosuWindow, MockImage, Module, Object, PhysicsManager, Platform, PolygonCollidable, Range, Rect, Renderer, ResourceManager, SortedList, SoundManager, SpatialTree, Stage, StageDefinition, StageFactory, StageManager, SvgDocument, Symbol, TestingGame, TimerManager, TweenManager, TweenWrapper, Vector2, Viewport, WrappedScreen

Constant Summary

GAMEBOX_PATH =
File.join(File.dirname(__FILE__),"gamebox/")
MOUSE_LEFT =
enum += 1
MOUSE_MIDDLE =
enum += 1
MOUSE_RIGHT =
enum += 1
MOUSE_LMASK =
enum += 1
MOUSE_MMASK =
enum += 1
MOUSE_RMASK =
enum += 1
K_UNKNOWN =
enum += 1
K_FIRST =
enum += 1
K_BACKSPACE =
KbBackspace
K_TAB =
KbTab
K_CLEAR =
enum += 1
K_RETURN =
KbReturn
K_PAUSE =
enum += 1
K_ESCAPE =
KbEscape
K_SPACE =
KbSpace
K_EXCLAIM =
enum += 1
K_QUOTEDBL =
enum += 1
K_HASH =
enum += 1
K_DOLLAR =
enum += 1
K_AMPERSAND =
enum += 1
K_QUOTE =
enum += 1
K_LEFTPAREN =
enum += 1
K_RIGHTPAREN =
enum += 1
K_ASTERISK =
enum += 1
K_PLUS =
enum += 1
K_COMMA =
enum += 1
K_MINUS =
enum += 1
K_PERIOD =
enum += 1
K_SLASH =
enum += 1
K_0 =
Kb0
K_1 =
Kb1
K_2 =
Kb2
K_3 =
Kb3
K_4 =
Kb4
K_5 =
Kb5
K_6 =
Kb6
K_7 =
Kb7
K_8 =
Kb8
K_9 =
Kb9
K_COLON =
enum += 1
K_SEMICOLON =
enum += 1
K_LESS =
enum += 1
K_EQUALS =
enum += 1
K_GREATER =
enum += 1
K_QUESTION =
enum += 1
K_AT =
enum += 1
K_LEFTBRACKET =
enum += 1
K_BACKSLASH =
enum += 1
K_RIGHTBRACKET =
enum += 1
K_CARET =
enum += 1
K_UNDERSCORE =
enum += 1
K_BACKQUOTE =
enum += 1
K_A =
KbA
K_B =
KbB
K_C =
KbC
K_D =
KbD
K_E =
KbE
K_F =
KbF
K_G =
KbG
K_H =
KbH
K_I =
KbI
K_J =
KbJ
K_K =
KbK
K_L =
KbL
K_M =
KbM
K_N =
KbN
K_O =
KbO
K_P =
KbP
K_Q =
KbQ
K_R =
KbR
K_S =
KbS
K_T =
KbT
K_U =
KbU
K_V =
KbV
K_W =
KbW
K_X =
KbX
K_Y =
KbY
K_Z =
KbZ
K_DELETE =
KbDelete
K_WORLD_0 =
enum += 1
K_WORLD_1 =
enum += 1
K_WORLD_2 =
enum += 1
K_WORLD_3 =
enum += 1
K_WORLD_4 =
enum += 1
K_WORLD_5 =
enum += 1
K_WORLD_6 =
enum += 1
K_WORLD_7 =
enum += 1
K_WORLD_8 =
enum += 1
K_WORLD_9 =
enum += 1
K_WORLD_10 =
enum += 1
K_WORLD_11 =
enum += 1
K_WORLD_12 =
enum += 1
K_WORLD_13 =
enum += 1
K_WORLD_14 =
enum += 1
K_WORLD_15 =
enum += 1
K_WORLD_16 =
enum += 1
K_WORLD_17 =
enum += 1
K_WORLD_18 =
enum += 1
K_WORLD_19 =
enum += 1
K_WORLD_20 =
enum += 1
K_WORLD_21 =
enum += 1
K_WORLD_22 =
enum += 1
K_WORLD_23 =
enum += 1
K_WORLD_24 =
enum += 1
K_WORLD_25 =
enum += 1
K_WORLD_26 =
enum += 1
K_WORLD_27 =
enum += 1
K_WORLD_28 =
enum += 1
K_WORLD_29 =
enum += 1
K_WORLD_30 =
enum += 1
K_WORLD_31 =
enum += 1
K_WORLD_32 =
enum += 1
K_WORLD_33 =
enum += 1
K_WORLD_34 =
enum += 1
K_WORLD_35 =
enum += 1
K_WORLD_36 =
enum += 1
K_WORLD_37 =
enum += 1
K_WORLD_38 =
enum += 1
K_WORLD_39 =
enum += 1
K_WORLD_40 =
enum += 1
K_WORLD_41 =
enum += 1
K_WORLD_42 =
enum += 1
K_WORLD_43 =
enum += 1
K_WORLD_44 =
enum += 1
K_WORLD_45 =
enum += 1
K_WORLD_46 =
enum += 1
K_WORLD_47 =
enum += 1
K_WORLD_48 =
enum += 1
K_WORLD_49 =
enum += 1
K_WORLD_50 =
enum += 1
K_WORLD_51 =
enum += 1
K_WORLD_52 =
enum += 1
K_WORLD_53 =
enum += 1
K_WORLD_54 =
enum += 1
K_WORLD_55 =
enum += 1
K_WORLD_56 =
enum += 1
K_WORLD_57 =
enum += 1
K_WORLD_58 =
enum += 1
K_WORLD_59 =
enum += 1
K_WORLD_60 =
enum += 1
K_WORLD_61 =
enum += 1
K_WORLD_62 =
enum += 1
K_WORLD_63 =
enum += 1
K_WORLD_64 =
enum += 1
K_WORLD_65 =
enum += 1
K_WORLD_66 =
enum += 1
K_WORLD_67 =
enum += 1
K_WORLD_68 =
enum += 1
K_WORLD_69 =
enum += 1
K_WORLD_70 =
enum += 1
K_WORLD_71 =
enum += 1
K_WORLD_72 =
enum += 1
K_WORLD_73 =
enum += 1
K_WORLD_74 =
enum += 1
K_WORLD_75 =
enum += 1
K_WORLD_76 =
enum += 1
K_WORLD_77 =
enum += 1
K_WORLD_78 =
enum += 1
K_WORLD_79 =
enum += 1
K_WORLD_80 =
enum += 1
K_WORLD_81 =
enum += 1
K_WORLD_82 =
enum += 1
K_WORLD_83 =
enum += 1
K_WORLD_84 =
enum += 1
K_WORLD_85 =
enum += 1
K_WORLD_86 =
enum += 1
K_WORLD_87 =
enum += 1
K_WORLD_88 =
enum += 1
K_WORLD_89 =
enum += 1
K_WORLD_90 =
enum += 1
K_WORLD_91 =
enum += 1
K_WORLD_92 =
enum += 1
K_WORLD_93 =
enum += 1
K_WORLD_94 =
enum += 1
K_WORLD_95 =
enum += 1
K_KP0 =
enum += 1
K_KP1 =
enum += 1
K_KP2 =
enum += 1
K_KP3 =
enum += 1
K_KP4 =
enum += 1
K_KP5 =
enum += 1
K_KP6 =
enum += 1
K_KP7 =
enum += 1
K_KP8 =
enum += 1
K_KP9 =
enum += 1
K_KP_PERIOD =
enum += 1
K_KP_DIVIDE =
enum += 1
K_KP_MULTIPLY =
enum += 1
K_KP_MINUS =
enum += 1
K_KP_PLUS =
enum += 1
K_KP_ENTER =
enum += 1
K_KP_EQUALS =
enum += 1
K_UP =
KbUp
K_DOWN =
KbDown
K_RIGHT =
KbRight
K_LEFT =
KbLeft
K_INSERT =
enum += 1
K_HOME =
KbHome
K_END =
KbEnd
K_PAGEUP =
enum += 1
K_PAGEDOWN =
enum += 1
K_F1 =
enum += 1
K_F2 =
enum += 1
K_F3 =
enum += 1
K_F4 =
enum += 1
K_F5 =
enum += 1
K_F6 =
enum += 1
K_F7 =
enum += 1
K_F8 =
enum += 1
K_F9 =
enum += 1
K_F10 =
enum += 1
K_F11 =
enum += 1
K_F12 =
enum += 1
K_F13 =
enum += 1
K_F14 =
enum += 1
K_F15 =
enum += 1
K_NUMLOCK =
enum += 1
K_CAPSLOCK =
enum += 1
K_SCROLLOCK =
enum += 1
K_RSHIFT =
enum += 1
K_LSHIFT =
enum += 1
K_RCTRL =
enum += 1
K_LCTRL =
enum += 1
K_RALT =
enum += 1
K_LALT =
enum += 1
K_RMETA =
enum += 1
K_LMETA =
enum += 1
K_LSUPER =
enum += 1
K_RSUPER =
enum += 1
K_MODE =
enum += 1
K_HELP =
enum += 1
K_PRINT =
enum += 1
K_SYSREQ =
enum += 1
K_BREAK =
enum += 1
K_MENU =
enum += 1
K_POWER =
enum += 1
K_EURO =
enum += 1
K_LAST =
enum += 1
K_MOD_NONE =
enum += 1
K_MOD_LSHIFT =
enum += 1
K_MOD_RSHIFT =
enum += 1
K_MOD_LCTRL =
enum += 1
K_MOD_RCTRL =
enum += 1
K_MOD_LALT =
enum += 1
K_MOD_RALT =
enum += 1
K_MOD_LMETA =
enum += 1
K_MOD_RMETA =
enum += 1
K_MOD_NUM =
enum += 1
K_MOD_CAPS =
enum += 1
K_MOD_MODE =
enum += 1
K_MOD_RESERVED =
enum += 1
K_MOD_CTRL =
enum += 1
K_MOD_SHIFT =
enum += 1
K_MOD_ALT =
enum += 1
K_MOD_META =
enum += 1
MOUSE2STR =

key/mouse event mappings Hash to translate mouse button sym to string

{
  MOUSE_LEFT => "left",
  MOUSE_MIDDLE => "middle",
  MOUSE_RIGHT => "right"
}
STR2MOUSE =

And to translate the other way…

MOUSE2STR.invert()
KEY2ASCII =

All the keys which have ASCII print values It is 87 lines from here to the closing }, if you want to skip it…

{
  K_BACKSPACE => "\b",
  K_TAB => "\t",
  K_RETURN => "\n", #SDL docs: "\r". Win vs *nix? What about Mac?
  K_ESCAPE => "^[",
  K_SPACE => " ",
  K_EXCLAIM => "!",
  K_QUOTEDBL => "\"",
  K_HASH => "#",
  K_DOLLAR => "$",
  K_AMPERSAND => "&",
  K_QUOTE => "\'",
  K_LEFTPAREN => "(",
  K_RIGHTPAREN => ")",
  K_ASTERISK => "*",
  K_PLUS => "+",
  K_COMMA => ",",
  K_MINUS => "-",
  K_PERIOD => ".",
  K_SLASH => "/",
  K_0 => "0",
  K_1 => "1",
  K_2 => "2",
  K_3 => "3",
  K_4 => "4",
  K_5 => "5",
  K_6 => "6",
  K_7 => "7",
  K_8 => "8",
  K_9 => "9",
  K_COLON => ":",
  K_SEMICOLON => ";",
  K_LESS => "<",
  K_EQUALS => "=",
  K_GREATER => ">",
  K_QUESTION => "?",
  K_AT => "@",
  K_LEFTBRACKET => "[",
  K_BACKSLASH => "\\",
  K_RIGHTBRACKET => "]",
  K_CARET => "^",
  K_UNDERSCORE => "_",
  K_BACKQUOTE => "`",
  K_A => "a",
  K_B => "b",
  K_C => "c",
  K_D => "d",
  K_E => "e",
  K_F => "f",
  K_G => "g",
  K_H => "h",
  K_I => "i",
  K_J => "j",
  K_K => "k",
  K_L => "l",
  K_M => "m",
  K_N => "n",
  K_O => "o",
  K_P => "p",
  K_Q => "q",
  K_R => "r",
  K_S => "s",
  K_T => "t",
  K_U => "u",
  K_V => "v",
  K_W => "w",
  K_X => "x",
  K_Y => "y",
  K_Z => "z",
  K_KP0 => "0",
  K_KP1 => "1",
  K_KP2 => "2",
  K_KP3 => "3",
  K_KP4 => "4",
  K_KP5 => "5",
  K_KP6 => "6",
  K_KP7 => "7",
  K_KP8 => "8",
  K_KP9 => "9",
  K_KP_PERIOD => ".",
  K_KP_DIVIDE => "/",
  K_KP_MULTIPLY => "*",
  K_KP_MINUS => "-",
  K_KP_PLUS => "+",
  K_KP_ENTER => "\n", #again, SDL docs say "\r"
  K_KP_EQUALS => "=",
}
ASCII2KEY =

And to translate the other way…

KEY2ASCII.invert()
KEY2LOWER =

All the keys that are affected by the Shift key, in lower case 49 lines from here to the end of the hash

{
  K_QUOTE => "\'",
  K_COMMA => ",",
  K_MINUS => "-",
  K_PERIOD => ".",
  K_SLASH => "/",
  K_0 => "0",
  K_1 => "1",
  K_2 => "2",
  K_3 => "3",
  K_4 => "4",
  K_5 => "5",
  K_6 => "6",
  K_7 => "7",
  K_8 => "8",
  K_9 => "9",
  K_SEMICOLON => ";",
  K_EQUALS => "=",
  K_LEFTBRACKET => "[",
  K_BACKSLASH => "\\",
  K_RIGHTBRACKET => "]",
  K_BACKQUOTE => "`",
  K_A => "a",
  K_B => "b",
  K_C => "c",
  K_D => "d",
  K_E => "e",
  K_F => "f",
  K_G => "g",
  K_H => "h",
  K_I => "i",
  K_J => "j",
  K_K => "k",
  K_L => "l",
  K_M => "m",
  K_N => "n",
  K_O => "o",
  K_P => "p",
  K_Q => "q",
  K_R => "r",
  K_S => "s",
  K_T => "t",
  K_U => "u",
  K_V => "v",
  K_W => "w",
  K_X => "x",
  K_Y => "y",
  K_Z => "z",
}
KEY2UPPER =

All the keys that are affected by the Shift key, in UPPER case 49 lines from here to the end of the hash

{
  K_QUOTE => "\"",
  K_COMMA => "<",
  K_MINUS => "_",
  K_PERIOD => ">",
  K_SLASH => "?",
  K_0 => ")",
  K_1 => "!",
  K_2 => "@",
  K_3 => "#",
  K_4 => "$",
  K_5 => "%",
  K_6 => "^",
  K_7 => "&",
  K_8 => "*",
  K_9 => "(",
  K_SEMICOLON => ":",
  K_EQUALS => "+",
  K_LEFTBRACKET => "{",
  K_BACKSLASH => "|",
  K_RIGHTBRACKET => "}",
  K_BACKQUOTE => "~",
  K_A => "A",
  K_B => "B",
  K_C => "C",
  K_D => "D",
  K_E => "E",
  K_F => "F",
  K_G => "G",
  K_H => "H",
  K_I => "I",
  K_J => "J",
  K_K => "K",
  K_L => "L",
  K_M => "M",
  K_N => "N",
  K_O => "O",
  K_P => "P",
  K_Q => "Q",
  K_R => "R",
  K_S => "S",
  K_T => "T",
  K_U => "U",
  K_V => "V",
  K_W => "W",
  K_X => "X",
  K_Y => "Y",
  K_Z => "Z",
}
FULL_CURTAIN =
255
NO_CURTAIN =
0
KbRangeBegin =
0
KbRangeEnd =
0xffff
MsRangeBegin =
MsLeft
MsRangeEnd =
MsWheelDown
GpRangeBegin =
GpLeft
GpRangeEnd =
Gp3Button15
BUTTON_ID_TO_SYM =
{
  KbRangeBegin => :keyboard_begin,
  KbEscape => :escape,
  KbF1 => :f1,
  KbF2 => :f2,
  KbF3 => :f3,
  KbF4 => :f4,
  KbF5 => :f5,
  KbF6 => :f6,
  KbF7 => :f7,
  KbF8 => :f8,
  KbF9 => :f9,
  KbF10 => :f10,
  KbF11 => :f11,
  KbF12 => :f12,
  Kb1 => :one,
  Kb2 => :two,
  Kb3 => :three,
  Kb4 => :four,
  Kb5 => :five,
  Kb6 => :six,
  Kb7 => :seven,
  Kb8 => :eight,
  Kb9 => :nine,
  Kb0 => :zero,
  KbA => :a,
  KbB => :b,
  KbC => :c,
  KbD => :d,
  KbE => :e,
  KbF => :f,
  KbG => :g,
  KbH => :h,
  KbI => :i,
  KbJ => :j,
  KbK => :k,
  KbL => :l,
  KbM => :m,
  KbN => :n,
  KbO => :o,
  KbP => :p,
  KbQ => :q,
  KbR => :r,
  KbS => :s,
  KbT => :t,
  KbU => :u,
  KbV => :v,
  KbW => :w,
  KbX => :x,
  KbY => :y,
  KbZ => :z,
  KbTab => :tab,
  KbReturn => :return,
  KbSpace => :space,
  KbLeftShift => :left_shift,
  KbRightShift => :right_shift,
  KbLeftControl => :left_control,
  KbRightControl => :right_control,
  KbLeftAlt => :left_alt,
  KbRightAlt => :right_alt,
  KbLeftMeta => :left_meta,
  KbRightMeta => :right_meta,
  KbBackspace => :backspace,
  KbLeft => :left,
  KbRight => :right,
  KbUp => :up,
  KbDown => :down,
  KbHome => :home,
  KbEnd => :end,
  KbInsert => :insert,
  KbDelete => :delete,
  KbPageUp => :page_up,
  KbPageDown => :page_down,
  KbEnter => :enter,
  KbNumpad1 => :numpad_1,
  KbNumpad2 => :numpad_2,
  KbNumpad3 => :numpad_3,
  KbNumpad4 => :numpad_4,
  KbNumpad5 => :numpad_5,
  KbNumpad6 => :numpad_6,
  KbNumpad7 => :numpad_7,
  KbNumpad8 => :numpad_8,
  KbNumpad9 => :numpad_9,
  KbNumpad0 => :numpad_0,
  KbNumpadAdd => :numpad_add,
  KbNumpadSubtract => :numpad_subtract,
  KbNumpadMultiply => :numpad_multiply,
  KbNumpadDivide => :numpad_divide,
  KbRangeEnd => :keyboard_end,
  MsRangeBegin => :mouse_begin,
  MsLeft => :mouse_left,
  MsRight => :mouse_right,
  MsMiddle => :mouse_middle,
  MsWheelUp => :mouse_wheel_up,
  MsWheelDown => :mouse_wheel_down,
  MsRangeEnd => :mouse_end,
  GpRangeBegin => :gp_begin,
  GpLeft => :gp_left,
  GpRight => :gp_right,
  GpUp => :gp_up,
  GpDown => :gp_down,
  GpButton0 => :gp_button_0,
  GpButton1 => :gp_button_1,
  GpButton2 => :gp_button_2,
  GpButton3 => :gp_button_3,
  GpButton4 => :gp_button_4,
  GpButton5 => :gp_button_5,
  GpButton6 => :gp_button_6,
  GpButton7 => :gp_button_7,
  GpButton8 => :gp_button_8,
  GpButton9 => :gp_button_9,
  GpButton10 => :gp_button_10,
  GpButton11 => :gp_button_11,
  GpButton12 => :gp_button_12,
  GpButton13 => :gp_button_13,
  GpButton14 => :gp_button_14,
  GpButton15 => :gp_button_15,
  GpRangeEnd => :gp_end,
}
BUTTON_SYM_TO_ID =

if multi gp support

BUTTON_ID_TO_SYM.invert
ZERO_VEC_2 =
vec2(0,0)

Instance Method Summary collapse

Methods included from Gamebox

configuration, configure

Methods included from GameboxDSL

#define_actor, #define_actor_view, #define_behavior, #define_stage

Instance Method Details

#log(output, level = :debug) ⇒ Object

TODO move this to some logging class



12
13
14
15
# File 'lib/gamebox.rb', line 12

def log(output, level = :debug)
  t = Time.now
  puts "[#{t.min}:#{t.sec}:#{t.usec}] [#{level}] #{output}"
end

#vec2(*args) ⇒ Object



2
3
4
# File 'lib/gamebox/core/physics.rb', line 2

def vec2(*args)
  CP::Vec2.new *args
end