Code for the car and bridge class CCarAndBridge.
#include "Car.h"
#include "GameDefines.h"
#include "Box2DRenderer.h"
|
| void | RemapPoints (b2Vec2 p[], int n, int w, int h) |
| | Translate an array of points from artist world to physics world.
|
| |
|
|
const float | DEFAULT_SPEED = 32.0f |
| | Default car speed.
|
| |
◆ 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
-
| p | Array of 2D points. |
| n | Number of points in a. |
| w | Double the distance to move the points in X direction. |
| h | Double the distance to move the points in Y direction. |