This repository has been archived by the owner on May 3, 2022. It is now read-only.
/
Physics.h
70 lines (56 loc) · 1.58 KB
/
Physics.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef _PHYSICS__H_
#define _PHYSICS__H_
//
// Physics.h
// Button
//
// Created by Axis Sivitz on 12/11/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#include <Box2D/Box2D.h>
#include "GLES-Render.h"
//#import "BContactListener.h"
//#import <vector>
typedef b2Vec2 vec2;
#define VECZERO vec2(0,0)
#define VECNULL vec2(-928484,-2929383)
#define RAD_2_DEG(x) (x * 180.0) / M_PI
#define DEG_2_RAD(x) (x * M_PI) / 180.0
#define ANGLE(vec) (atan2(vec.x,-vec.y))
vec2 midpoint(vec2 one, vec2 two);
using namespace std;
class Physics
{
private:
//BContactListener * m_contactListener;
public:
b2Filter defaultFilter;
GLESDebugDraw * m_debugDraw;
b2World * boxworld;
Physics();
~Physics();
void initDebugDrawing();
void debugDraw();
b2Body * addButton(vec2 pos, float size);
b2Body * addWall(vec2 pos, vec2 extens);
b2Body * addGrate(vec2 pos, vec2 extens);
b2Body * addDoor(vec2 pos, vec2 extens);
//b2Body * castRay(vec2 from, vec2 to);
b2Body * addParticle(vec2 pos);
b2Body * addSensor(vec2 pos, vec2 extens);
b2Body * addWormSection(vec2 pos, float radius);
b2Body * addGrenade(vec2 pos, float size);
b2Body * addPlayer(vec2 pos, float size);
b2Body * addEmptyBody(vec2 pos);
b2Body * addDummy(vec2 pos, vec2 extens);
void remove(b2Body * obj);
void tick(double time);
vec2 worldBottomRight();
};
bool isVecZero(vec2 inVec);
float dotProduct(vec2 vec1, vec2 vec2);
vec2 rotate(vec2 inVec, float angle);
vec2 randomOffset();
vec2 lerp(vec2 one, vec2 two, float interp);
vec2 centerPoint(vec2 inPoint);
#endif