#ifndef PHYSICS_EXAMPLES #define PHYSICS_EXAMPLES #include "inc/rat_physics.h" #include "drawutil/draw.h" #include "drawutil/ortho.h" #include "drawutil/font.h" #include "drawutil/extensions.h" #if defined(RAT_PHYSICS_WINDOWS) # include "SDL\include\SDL.h" # include "SDL\include\SDL_opengl.h" # include #else # include # include #endif #include #include #include #include #include #define WINDOW_WIDTH 800 #define WINDOW_HEIGHT 600 #define SCENE_WIDTH 800 #define SCENE_HEIGHT 600 using namespace std; class RatPhysicsExample { public: rat_world *world; string title; vector2 bounds; vector2 pickoffset; RatPhysicsExample(string name); RatPhysicsExample(const char *name); RatPhysicsExample(char *name); virtual bool InitWorld()=0; virtual bool UpdateWorld(rat_real timestep)=0; virtual bool UpdateVisuals()=0; virtual bool FreeWorld()=0; bool WorldPointPick(vector2 point,rat_body **bodypicked,vector2 *local_picked); }; extern rat_glyph_font *glyphfont; extern rat_texture_font *outfont; extern const unsigned int num_examples; extern char keys[SDLK_LAST]; extern bool show_arbiters; extern bool show_aabbs; extern bool show_quadtree; extern rat_body *grabbed_body; extern rat_spring *grabbed_spring; extern bool has_grabbed; extern vector2 world_cursor; void rat_examples_create_walls(rat_world *world); void rat_examples_create_circle_row(rat_world *world,rat_real diameter,rat_real padx,rat_real y,rat_real xcenter,unsigned int numcircs,int tag); void rat_examples_create_box_row(rat_world *world,vector2 boxsize,rat_real padx,rat_real y,rat_real xcenter,unsigned int numboxes,int tag); void rat_examples_create_chain(rat_world *world,bool anchored,vector2 boxsize,rat_real y,rat_real xcenter,unsigned int numboxes,int tag); void rat_examples_leave_world_callback(rat_world *world,rat_body *body,void *userdata); #endif