root / branches / cpp-ode / src / mmpong-gl / netgame_ode_pong_gl.h @ 538

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
10namespace mmp {
11
12class 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                        //if(ent->get_classid() == NetEnt::ODEBox) {
23                        //      boost::shared_ptr<ODEBoxGL> box=boost::dynamic_pointer_cast<ODEBoxGL>(ent);
24                        //      paddles[teams++]=box;
25                        //      LOG("This box says (NetGameODEPongGL): " << box->str);
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                        //for (std::map<uint16_t, boost::shared_ptr<ODEBoxGL> >::iterator it=paddles.begin(); it!=paddles.end(); it++)
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//              uint16_t teams;
48//              std::map<uint16_t, boost::shared_ptr<ODEBoxGL> > paddles;
49};
50
51}
52
53#endif
Note: See TracBrowser for help on using the browser.