Rube Goldberg Machine 1.0
This is the base code for Rube Goldberg designed for the CS296 Software Systems Lab
Classes | Typedefs | Variables
cs296 Namespace Reference

These are user defined include files Included in double quotes - the path to find these has to be given at compile time. More...

Classes

class  callbacks_t
struct  settings_t
 Simulation settings. Some can be controlled in the GUI. More...
struct  sim_t
 the sim_t stores a string and object pointer to base_sim_t More...
struct  contact_point_t
 The contact_point_t stores contact point. More...
class  base_sim_t
 the base_sim_t class is used to simulate the Box2D world. inherited from the b2ContactListener. More...
class  dominos_t
 This is the class that sets up the Box2D simulation world Notice the public inheritance - why do we inherit the base_sim_t class? More...

Typedefs

typedef base_sim_tsim_create_fcn ()
 Why do we use a typedef? Creates a new datatype. sim_create_fcn() acts as a pointer datatype to base_sim_t class.

Variables

int32 test_index = 0
int32 test_selection = 0
int32 test_count = 0
cs296::sim_tentry
cs296::base_sim_ttest
cs296::settings_t settings
int32 width = 640
int32 height = 480
int32 frame_period = 16
int32 main_window
float settings_hz = 60.0
float32 view_zoom = 1.0f
int tx
int ty
int tw
int th
bool r_mouse_down
b2Vec2 lastp
sim_tsim = new sim_t("Dominos", dominos_t::create)
const int32 k_max_contact_points = 2048

Detailed Description

These are user defined include files Included in double quotes - the path to find these has to be given at compile time.

Notice the use of these pre-processor directives on top of each header file Why are they used?

The namespace protects the global variables and other names from clashes in scope. Read about the use of named and unnamed namespaces in C++ Figure out where all the datatypes used below are defined

This file defines all the callback functions our code needs. Why are they not members of a class? Can you make them into a class?

Callback functions are called when a event occurs due to the press of a key, mouse button, or a GUI element like a menu item is clicked or scroller is dragged. Some callbacks are triggered after a fixed intervals when a timer elapses. These are user defined include files Included in double quotes - the path to find these has to be given at compile time

GLUI is the library used for drawing the GUI Learn more about GLUI by reading the GLUI documentation Learn to use preprocessor diectives to make your code portable These are standard include files These are usually available at standard system paths like /usr/include Read about the use of include files in C++ Notice the use of extern. Why is it used here?


Typedef Documentation

Why do we use a typedef? Creates a new datatype. sim_create_fcn() acts as a pointer datatype to base_sim_t class.

Definition at line 43 of file cs296_base.hpp.


Variable Documentation

Definition at line 26 of file callbacks.cpp.

const int32 cs296::frame_period = 16

Definition at line 31 of file callbacks.cpp.

int32 cs296::height = 480

Definition at line 30 of file callbacks.cpp.

const int32 cs296::k_max_contact_points = 2048

Definition at line 123 of file cs296_base.hpp.

b2Vec2 cs296::lastp

Definition at line 37 of file callbacks.cpp.

Definition at line 32 of file callbacks.cpp.

Definition at line 36 of file callbacks.cpp.

Definition at line 28 of file callbacks.cpp.

float cs296::settings_hz = 60.0

Definition at line 33 of file callbacks.cpp.

sim_t * cs296::sim = new sim_t("Dominos", dominos_t::create)

Definition at line 842 of file dominos.cpp.

Definition at line 27 of file callbacks.cpp.

int32 cs296::test_count = 0

Definition at line 25 of file callbacks.cpp.

int32 cs296::test_index = 0

Definition at line 23 of file callbacks.cpp.

Definition at line 24 of file callbacks.cpp.

int cs296::th

Definition at line 35 of file callbacks.cpp.

int cs296::tw

Definition at line 35 of file callbacks.cpp.

int cs296::tx

Definition at line 35 of file callbacks.cpp.

int cs296::ty

Definition at line 35 of file callbacks.cpp.

float32 cs296::view_zoom = 1.0f

Definition at line 34 of file callbacks.cpp.

int32 cs296::width = 640

Definition at line 29 of file callbacks.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Friends Defines