|
Revision 538, 1.6 kB
(checked in by gaul@…, 7 months ago)
|
- NASTY async socket bug resolved
|
| Line | |
|---|
| 1 | #ifndef __NETGAME_ODE_GL_H__ |
|---|
| 2 | #define __NETGAME_ODE_GL_H__ |
|---|
| 3 | |
|---|
| 4 | #include <libmmpong/netgame_ode_pong.h> |
|---|
| 5 | |
|---|
| 6 | #include "ode_box_gl.h" |
|---|
| 7 | #include "ode_sphere_gl.h" |
|---|
| 8 | #include "hid.h" |
|---|
| 9 | |
|---|
| 10 | namespace mmp { |
|---|
| 11 | |
|---|
| 12 | class NetGameODEPongGL : public NetGameODEPong, public HID { |
|---|
| 13 | public: |
|---|
| 14 | static pointer create(NetCon::pointer cln_con_, const std::string& _playername, const std::string& _resdir) { |
|---|
| 15 | return pointer(new NetGameODEPongGL(cln_con_, _playername, _resdir)); |
|---|
| 16 | }; |
|---|
| 17 | protected: |
|---|
| 18 | NetGameODEPongGL(NetCon::pointer cln_con, const std::string &_playername, const std::string& _resdir); |
|---|
| 19 | public: |
|---|
| 20 | virtual NetEnt::pointer cln_ent_new(NetMsg::pointer msg) { |
|---|
| 21 | NetEnt::pointer ent=NetGameODE::cln_ent_new(msg); |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | return ent; |
|---|
| 28 | }; |
|---|
| 29 | virtual void cln_msg_custom(NetMsg::pointer msg); |
|---|
| 30 | |
|---|
| 31 | virtual void render() { |
|---|
| 32 | LOG("NetGameODEPongGL::render() called"); |
|---|
| 33 | |
|---|
| 34 | for (std::map<uint16_t, NetEnt::pointer>::iterator it=ents.begin(); it!=ents.end(); it++) |
|---|
| 35 | it->second->render(); |
|---|
| 36 | |
|---|
| 37 | }; |
|---|
| 38 | |
|---|
| 39 | virtual void process(Renderer& renderer, uint8_t *key_state, uint32_t mouse_state, int mouse_x, int mouse_y) { |
|---|
| 40 | if (mouse_x != 0 || mouse_y != 0) { |
|---|
| 41 | cln_set_paddlepos(mypadpos + (1.0/100)*mouse_y); |
|---|
| 42 | |
|---|
| 43 | } |
|---|
| 44 | }; |
|---|
| 45 | private: |
|---|
| 46 | std::string playername; |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | }; |
|---|
| 50 | |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | #endif |
|---|