Skip to content

RAM API Reference Events

Johann Diedrick edited this page Feb 4, 2015 · 8 revisions

Events

Summary

This page describes how to use ramEvents.

ramEvents are not to be confused with ofEvents, which work differently. A ramEvent has a boolean state, which is set to true when it is fired.

Table of Contents

Introduction to ramBaseEvent

ramBaseEvent is a base class for all RAMDanceToolkit events. Here is a small example of a new event class called "MyEvent".

class MyEvent : public ramBaseEvent
{

protected:
	bool tick()
	{
		// do something...
	}
};

When you call update() as implemented in ramBaseEvent, the boolean returned by tick() is returned to a caller. The cached value will be returned if you call update() many times in same frame.

// testApp.h
MyEvent event;

// testApp.cpp 
void testApp::update()
{
	if (event.update())
	{
		// do something...		
	}
}

ramCollisionEvent

ramCollisionEvent observes collision between ramPrimitive objects that are set to respond to a ramCollisionEvent. Other objects which also have collision detection include ramBox, ramLine etc.

Three trigger timings can be set to a ramCollisionEvent.

enum ramTriggerTiming
{
	RAM_TRIGGER_UP,
	RAM_TRIGGER_DOWN,
	RAM_TRIGGER_BOTH
};

ramScheduledTimerEvent

ramScheduledTimerEvent changes its state once per interval duration.

ramRandomTimerEvent

ramRandomTimerEvent changes its state once per interval duration, which is set randomly between min and max.


Creative Commons License
This Document by YCAM InterLab, Yoshito Onishi, Satoru Higa, Motoi Shimizu, and Kyle McDonald is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.