My Project
|
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 #pragma once 00029 #include "ImageBox.h" 00030 #include <Box2D\Box2D.h> 00031 00032 #pragma comment(lib, "box2d.lib") 00033 00034 namespace SallyAPI 00035 { 00036 namespace GUI 00037 { 00046 00047 class CBox2DObject: 00048 public SallyAPI::GUI::CImageBox 00049 { 00050 private: 00051 b2World* m_pb2World; 00052 b2Body* m_pb2Body; 00053 b2Shape* m_pb2Shape; 00054 b2MouseJoint* m_pb2MouseJoint; 00055 00056 void DeleteMouseJoint(); 00057 void CreateShape(); 00058 00059 virtual void ResizeInternal(int width, int height); 00060 00061 virtual bool ProcessMouseMove(int x, int y); 00062 virtual bool ProcessMouseUp(int x, int y); 00063 virtual bool ProcessMouseDown(int x, int y); 00064 public: 00065 CBox2DObject(SallyAPI::GUI::CGUIBaseObject* parent, int x, int y, int width, int height, int controlId = 0); 00066 ~CBox2DObject(); 00067 00068 virtual void SendMessageToChilds(SallyAPI::GUI::CGUIBaseObject* reporter, int reporterId, int messageId, SallyAPI::GUI::SendMessage::CParameterBase* messageParameter = NULL); 00069 00070 bool CreateBox2DObject(b2World* world); 00071 b2Body* GetBox2DObject(); 00072 00073 virtual void Timer(float timeDelta); 00074 bool MoveAndHold(int x, int y); 00075 }; 00076 } 00077 }