C+#包括警卫
#ifndef PHYSICS_H#define PHYSICS_H#include "GameObject.h"#include <list>class Physics{private: double gravity; list<GameObject*> objects; list<GameObject*>::iterator i;public: Physics(void); void ApplyPhysics(GameObject*); void UpdatePhysics(int); bool RectangleIntersect(SDL_Rect, SDL_Rect); Vector2X CheckCollisions(Vector2X, GameObject*);};#endif // PHYSICS_H
#include "Texture2D.h"#include "Vector2X.h"#include <SDL.h>#include "Physics.h"class GameObject{private: SDL_Rect collisionBox;public: Texture2D texture; Vector2X position; double gravityForce; int weight; bool isOnGround; GameObject(void); GameObject(Texture2D, Vector2X, int); void UpdateObject(int); void Draw(SDL_Surface*); void SetPosition(Vector2X); SDL_Rect GetCollisionBox();};
慕森卡
相关分类