![]() |
CUGL 3.0
Cornell University Game Library
|
Namespaces | |
namespace | audio |
namespace | filetool |
namespace | graphics |
namespace | hashtool |
namespace | netcode |
namespace | physics2 |
namespace | poly2 |
namespace | scene2 |
namespace | scene3 |
namespace | strtool |
Typedefs | |
typedef std::function< void(float t, ActionState state)> | ActionFunction |
typedef std::function< void(const std::string key, float time, float actual)> | ActionListener |
typedef std::function< float(float)> | EasingFunction |
typedef std::function< void(const std::string key, bool success)> | LoaderCallback |
typedef Sint64 | TouchID |
typedef Vec2 | Point2 |
typedef Vec3 | Point3 |
Enumerations | |
enum class | ActionState : int { BEGIN , UPDATE , FINISH } |
enum class | KeyCode : int { NUM_0 = SDLK_0 , NUM_1 = SDLK_1 , NUM_2 = SDLK_2 , NUM_3 = SDLK_3 , NUM_4 = SDLK_4 , NUM_5 = SDLK_5 , NUM_6 = SDLK_6 , NUM_7 = SDLK_7 , NUM_8 = SDLK_8 , NUM_9 = SDLK_9 , A = SDLK_a , B = SDLK_b , C = SDLK_c , D = SDLK_d , E = SDLK_e , F = SDLK_f , G = SDLK_g , H = SDLK_h , I = SDLK_i , J = SDLK_j , K = SDLK_k , L = SDLK_l , M = SDLK_m , N = SDLK_n , O = SDLK_o , P = SDLK_p , Q = SDLK_q , R = SDLK_r , S = SDLK_s , T = SDLK_t , U = SDLK_u , V = SDLK_v , W = SDLK_w , X = SDLK_x , Y = SDLK_y , Z = SDLK_z , ARROW_DOWN = SDLK_DOWN , ARROW_LEFT = SDLK_LEFT , ARROW_RIGHT = SDLK_RIGHT , ARROW_UP = SDLK_UP , QUOTE = SDLK_QUOTE , BACKSLASH = SDLK_BACKSLASH , COMMA = SDLK_COMMA , EQUALS = SDLK_EQUALS , BACKQUOTE = SDLK_BACKQUOTE , LEFT_BRACKET = SDLK_LEFTBRACKET , MINUS = SDLK_MINUS , PERIOD = SDLK_PERIOD , RIGHT_BRACKET = SDLK_RIGHTBRACKET , SEMICOLON = SDLK_SEMICOLON , SLASH = SDLK_SLASH , BACKSPACE = SDLK_BACKSPACE , SPACE = SDLK_SPACE , TAB = SDLK_TAB , DEL = SDLK_DELETE , END = SDLK_END , ESCAPE = SDLK_ESCAPE , HOME = SDLK_HOME , HELP = SDLK_HELP , PAGE_DOWN = SDLK_PAGEDOWN , PAGE_UP = SDLK_PAGEUP , PAUSE = SDLK_PAUSE , RETURN = SDLK_RETURN , ENTER = SDLK_RETURN2 , CAPS_LOCK = SDLK_CAPSLOCK , LEFT_ALT = SDLK_LALT , LEFT_CTRL = SDLK_LCTRL , LEFT_SHIFT = SDLK_LSHIFT , LEFT_META = SDLK_LGUI , RIGHT_ALT = SDLK_RALT , RIGHT_CTRL = SDLK_RCTRL , RIGHT_SHIFT = SDLK_RSHIFT , RIGHT_META = SDLK_RGUI , NUMLOCK = SDLK_NUMLOCKCLEAR , KEYPAD_0 = SDLK_KP_0 , KEYPAD_1 = SDLK_KP_1 , KEYPAD_2 = SDLK_KP_2 , KEYPAD_3 = SDLK_KP_3 , KEYPAD_4 = SDLK_KP_4 , KEYPAD_5 = SDLK_KP_5 , KEYPAD_6 = SDLK_KP_6 , KEYPAD_7 = SDLK_KP_7 , KEYPAD_8 = SDLK_KP_8 , KEYPAD_9 = SDLK_KP_9 , KEYPAD_CLEAR = SDLK_KP_CLEAR , KEYPAD_EQUALS = SDLK_KP_EQUALS , KEYPAD_DIVIDE = SDLK_KP_DIVIDE , KEYPAD_MULTIPLY = SDLK_KP_MULTIPLY , KEYPAD_MINUS = SDLK_KP_MINUS , KEYPAD_PLUS = SDLK_KP_PLUS , KEYPAD_ENTER = SDLK_KP_ENTER , UNKNOWN = SDLK_POWER } |
enum class | KeyCategory { NUMBER , LETTER , ARROW , PUNCTUATION , SPECIAL , MODIFIER , KEYPAD , UNKNOWN } |
enum class | CoreGestureType : int { NONE = 0 , PAN = 1 , PINCH = 2 , SPIN = 3 } |
Functions | |
Vec2 & | operator*= (Vec2 &v, const Affine2 &m) |
const Vec2 | operator* (const Vec2 v, const Affine2 &m) |
const Affine2 | operator* (float scalar, const Affine2 &m) |
const Color4f | operator* (float s, const Color4f c) |
const Color4 | operator* (float s, Color4 c) |
Vec2 & | operator*= (Vec2 &v, const Mat4 &m) |
const Vec2 | operator* (const Vec2 v, const Mat4 &m) |
Vec3 & | operator*= (Vec3 &v, const Mat4 &m) |
const Vec3 | operator* (const Vec3 v, const Mat4 &m) |
Vec4 & | operator*= (Vec4 &v, const Mat4 &m) |
const Vec4 | operator* (const Vec4 v, const Mat4 &m) |
const Mat4 | operator* (float scalar, const Mat4 &m) |
Vec3 & | operator*= (Vec3 &v, const Quaternion &quat) |
const Vec3 | operator* (const Vec3 v, const Quaternion &quat) |
const Quaternion | operator* (float s, const Quaternion &quat) |
const Vec2 | operator* (float x, const Vec2 v) |
const Vec2 | operator/ (float x, const Vec2 v) |
const Vec3 | operator* (float x, const Vec3 v) |
const Vec3 | operator/ (float x, const Vec3 v) |
const Vec4 | operator* (float x, const Vec4 v) |
const Vec4 | operator/ (float x, const Vec4 v) |
SDL_FORCE_INLINE Uint16 | marshall (Sint16 value) |
SDL_FORCE_INLINE Uint16 | marshall (Uint16 value) |
SDL_FORCE_INLINE Uint32 | marshall (Sint32 value) |
SDL_FORCE_INLINE Uint32 | marshall (Uint32 value) |
SDL_FORCE_INLINE Uint64 | marshall (Sint64 value) |
SDL_FORCE_INLINE Uint64 | marshall (Uint64 value) |
SDL_FORCE_INLINE float | marshall (float value) |
SDL_FORCE_INLINE double | marshall (double value) |
The primary CUGL namespace
This namespace is for all classes and functions internal to the CUGL game engine. It does not include external tools like Box 2d or poly2tri.
This type represents an action to interpolate.
Actions can be represented as any function on the range [0,1], where 0 is the beginning of the action and 1 is the end of the action (e.g. time is normalized). The effect of this function on game state is user-defined.
For easing purposes, the interpolation function should support inputs outside the range [0,1], even if that just means clamping the input. In addition, the function should make no assumptions about monotonicity of the function calls; the value t can jump about unexpectedly.
Because of this, it can be hard to tell when the animation has just started and when it has ended. That is the purpose of the state attribute.
The function type is equivalent to
std::function<void(float t, ActionState state)>
t | The interpolation value [0,1] |
state | The action state |
This type represents a listener for monitoring an ActionTimeline
In CUGL, listeners are implemented as a set of callback functions, not as objects. This allows each listener to implement as much or as little functionality as it wants. A listener is identified by a key which should be a globally unique unsigned int.
Typically ActionTimeline
listeners are used for notifying when an action has completed. But like Unity, we allow for a callback function at any point of the timeline. With that said, frame rate imprecision means that the time at which the callback is executed is not exactly the same a time as when the listener is invoked.
Listener times are relative to the duration of the event, and are not normalized in the range [0,1].
The function type is equivalent to
std::function<void(const std::string key, float time, float actual)>
key | The key identifying the action |
time | The requested time of this callback |
actual | The actual time of this callback |
An easing function is an interpolation function that (usually) maps [0,1] to [0,1] with f(0) = 0 and f(1) = 1. It is used to control the speed of an action. If f(t) = t, the result is standard linear interpolation, providing a smooth animation. Nonlinear curves allow the animation to adjust its speed over time. An easing function can map outside of the range so long as the end points are still fixed. This allows for overshoot and correction in the animation. See
http://easings.net
For examples of easing functions.
This type represents a callback for asynchronous asset loading
This callback is associated with an asset at the time of the asychronous load request. When the asset either loads, or fails to load, this callback is called with the asset status.
In the case of JSON asset directories, a single callback may be associated with several assets. In that case, the callback funtion is called each time that an asset loads or fails to load. If an entire node in the asset directory fails to load, the callback function will be notified using the key for that JSON node.
The function type is equivalent to
std::function<void(const std::string key, bool success)>
key | The key to associate with the asset (or asset category) |
success | Whether the asset was successfully loaded |
typedef Vec2 cugl::Point2 |
Provide an alternative name for Vec2
typedef Vec3 cugl::Point3 |
Provide an alternative name for Vec3
typedef Sint64 cugl::TouchID |
This is the type representing a finger or touch
|
strong |
This class represents the state of an action.
Actions have a beginning, a middle, and end. Because of easing functions, it is never possible to tell which part we are in from the time alone. Therefore we use this enum to track this state.
Enumerator | |
---|---|
BEGIN | The start of this action (before the first update) |
UPDATE | The middle of this action (currently updating) |
FINISH | The end of this action (after the last update) |
|
strong |
This enum represents a core gesture type.
Core gestures are the primary two-finger gestures: pan, spin, and spread. This simple enumeration indicates which gestures have been recognized.
These types are currently exclusive (e.g. you cannot have a pan at the same time as a pinch). This is because the purpose of the core gesture device is to intelligently choose between gestures.
|
strong |
! This enum represents the category of the key
Categories are used to group key codes in rough groups
|
strong |
This is enum represents a key on a keyboard.
The keys available are subset of the full range of available keys. Because of our goal of cross-platform support, we only support keys that are found on most common keyboards.
The Input dispatcher will convert from an SDL keycode this enum. That means it is possible to receive a KeyCode that is not present in the enum. Any switch statement for this enum should have a default value.
SDL_FORCE_INLINE double cugl::marshall | ( | double | value | ) |
Returns the given value encoded in network order
On a big-endian system, this function has no effect. On a little-endian system, it swaps the bytes to put them in big-endian order.
This function is idempotent. To decode an encoded value, call this function on the value again.
value | The value to encode |
SDL_FORCE_INLINE float cugl::marshall | ( | float | value | ) |
Returns the given value encoded in network order
On a big-endian system, this function has no effect. On a little-endian system, it swaps the bytes to put them in big-endian order.
This function is idempotent. To decode an encoded value, call this function on the value again.
value | The value to encode |
SDL_FORCE_INLINE Uint16 cugl::marshall | ( | Sint16 | value | ) |
Returns the given value encoded in network order
On a big-endian system, this function has no effect. On a little-endian system, it swaps the bytes to put them in big-endian order.
This function is idempotent. To decode an encoded value, call this function on the value again.
value | The value to encode |
SDL_FORCE_INLINE Uint32 cugl::marshall | ( | Sint32 | value | ) |
Returns the given value encoded in network order
On a big-endian system, this function has no effect. On a little-endian system, it swaps the bytes to put them in big-endian order.
This function is idempotent. To decode an encoded value, call this function on the value again.
value | The value to encode |
SDL_FORCE_INLINE Uint64 cugl::marshall | ( | Sint64 | value | ) |
Returns the given value encoded in network order
On a big-endian system, this function has no effect. On a little-endian system, it swaps the bytes to put them in big-endian order.
This function is idempotent. To decode an encoded value, call this function on the value again.
value | The value to encode |
SDL_FORCE_INLINE Uint16 cugl::marshall | ( | Uint16 | value | ) |
Returns the given value encoded in network order
On a big-endian system, this function has no effect. On a little-endian system, it swaps the bytes to put them in big-endian order.
This function is idempotent. To decode an encoded value, call this function on the value again.
value | The value to encode |
SDL_FORCE_INLINE Uint32 cugl::marshall | ( | Uint32 | value | ) |
Returns the given value encoded in network order
On a big-endian system, this function has no effect. On a little-endian system, it swaps the bytes to put them in big-endian order.
This function is idempotent. To decode an encoded value, call this function on the value again.
value | The value to encode |
SDL_FORCE_INLINE Uint64 cugl::marshall | ( | Uint64 | value | ) |
Returns the given value encoded in network order
On a big-endian system, this function has no effect. On a little-endian system, it swaps the bytes to put them in big-endian order.
This function is idempotent. To decode an encoded value, call this function on the value again.
value | The value to encode |
Returns a copy of the vector after it is transformed.
v | The point to transform. |
m | The transform to apply. |
Returns a copy of the vector transformed by the given matrix.
The vector is treated as a point, which means that translation is applied to the result.
v | The point to transform. |
m | The matrix to transform by. |
Returns a copy of the vector transformed by the given matrix.
The vector is treated as a point, which means that translation is applied to the result.
v | The point to transform. |
m | The matrix to transform by. |
|
inline |
Returns a copy of the vector rotated by the quaternion.
The rotation is defined by the matrix associated with the vector. As per the convention for Mat4
, we only allow vectors to be multiplied on the right by quaternions.
v | The vector to rotate. |
quat | The rotation quaternion. |
Returns a copy of the vector transformed by the given matrix.
The vector is treated as is. Hence whether or not translation is applied depends on the value of w.
v | The point to transform. |
m | The matrix to transform by. |
Returns the scalar product of the given color with the given value.
The scaling is clamped so that this remains a valid color.
This version of scaling always multiplies the alpha values.
s | The value to scale by. |
c | The color to scale. |
Returns the scalar product of the given color with the given value.
The scaling is clamped so that this remains a valid color.
This version of scaling always multiplies the alpha values.
s | The value to scale by. |
c | The color to scale. |
|
inline |
Returns the scalar product of the quaternion with the given value.
s | The value to scale by. |
quat | The quaternion to scale. |
Multiplies the components of the given matrix by the specified scalar.
The scalar is applied to BOTH the core matrix and the offset.
scalar | The scalar value. |
m | The transform to scale. |
Multiplies the components of the given matrix by the specified scalar.
scalar | The scalar value. |
m | The matrix to transform by. |
Returns the scalar product of the given vector with the given value.
x | The value to scale by. |
v | The vector to scale. |
Returns the scalar product of the given vector with the given value.
x | The value to scale by. |
v | The vector to scale. |
Returns the scalar product of the given vector with the given value.
x | The value to scale by. |
v | The vector to scale. |
Transforms the given point in place.
v | The point to transform. |
m | The transform to apply. |
Transforms the given point by the given matrix.
The vector is treated as a point, which means that translation is applied to the result.
v | The point to transform. |
m | The matrix to transform by. |
Transforms the given point by the given matrix.
The vector is treated as a point, which means that translation is applied to the result.
v | The point to transform. |
m | The matrix to transform by. |
|
inline |
Rotates the vector in place by the quaternion.
The rotation is defined by the matrix associated with the vector. As per the convention for Mat4
, we only allow vectors to be multiplied on the right by quaternions.
v | The vector to rotate. |
quat | The rotation quaternion. |
Transforms the given point by the given matrix.
The vector is treated as is. Hence whether or not translation is applied depends on the value of w.
v | The point to transform. |
m | The matrix to transform by. |
Returns the division of the given value by the vector.
x | The value to divide |
v | The vector to divide by. |
Returns the division of the given value by the vector.
x | The value to divide |
v | The vector to divide by. |