Box2D Joint Toy
Game Physics with a 2D Physics Engine
Loading...
Searching...
No Matches
Car.cpp File Reference

Code for the car and bridge class CCarAndBridge.

#include "Car.h"
#include "GameDefines.h"
#include "Box2DRenderer.h"
Include dependency graph for Car.cpp:

Functions

void RemapPoints (b2Vec2 p[], int n, int w, int h)
 Translate an array of points from artist world to physics world.
 

Variables

const float DEFAULT_SPEED = 32.0f
 Default car speed.
 

Function Documentation

◆ RemapPoints()

void RemapPoints ( b2Vec2 p[],
int n,
int w,
int h )

Helper function to translate an array of points from artist world (measured in pixels from top left) to physics world (measured in physics world units from bottom left). This is so that you can measure distances in pixels using an image editor such as Paint.net, which measures from the top left corner with positive \(y\) values increasing downwards. Recall that physics world measures from the bottom left corner with positive \(y\) values increasing upwards.

Parameters
pArray of 2D points.
nNumber of points in a.
wDouble the distance to move the points in X direction.
hDouble the distance to move the points in Y direction.
Here is the call graph for this function:
Here is the caller graph for this function: