Browse Source

initial add

Bei Yang 15 years ago
parent
commit
be7a26dd12

+ 42 - 0
panda/src/awesomium/AwMouseAndKeyboard.cxx

@@ -0,0 +1,42 @@
+// Filename: AwMouseAndKeyboard.cxx
+// Created by:  Bei Yang (Mar2010)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) Carnegie Mellon University.  All rights reserved.
+//
+// All use of this software is subject to the terms of the revised BSD
+// license.  You should have received a copy of this license along
+// with this source code in a file named "LICENSE."
+//
+////////////////////////////////////////////////////////////////////
+
+#include "config_awesomium.h"
+#include "AwMouseAndKeyboard.h"
+#include "dataNodeTransmit.h"
+
+TypeHandle AwMouseAndKeyboard::_type_handle;
+
+AwMouseAndKeyboard::AwMouseAndKeyboard(GraphicsWindow *window, int device, const string &name):
+MouseAndKeyboard(window,device,name)
+{
+	//do nothing
+}
+
+
+void AwMouseAndKeyboard::do_transmit_data(DataGraphTraverser *trav, const DataNodeTransmit &input, DataNodeTransmit &output){
+
+	MouseAndKeyboard::do_transmit_data(trav,input,output);
+
+		int num_events = _button_events->get_num_events();
+		for (int i = 0; i < num_events; i++) {
+			const ButtonEvent &be = _button_events->get_event(i);
+			string event_name = be._button.get_name();
+			printf("Button pressed: %s ", event_name);
+			if(be._type == ButtonEvent::T_down ) printf(" down ");
+			if(be._type == ButtonEvent::T_repeat ) printf(" repeat ");
+			if(be._type == ButtonEvent::T_resume_down ) printf(" resume down ");
+			if(be._type == ButtonEvent::T_resume_down ) printf(" up ");
+		}
+}

+ 56 - 0
panda/src/awesomium/AwMouseAndKeyboard.h

@@ -0,0 +1,56 @@
+// Filename: awWebCore.h
+// Created by:  rurbino (12Oct09)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) Carnegie Mellon University.  All rights reserved.
+//
+// All use of this software is subject to the terms of the revised BSD
+// license.  You should have received a copy of this license along
+// with this source code in a file named "LICENSE."
+//
+////////////////////////////////////////////////////////////////////
+#ifndef AWWEBKEYBOARDMOUSE_H
+#define AWWEBKEYBOARDMOUSE_H
+
+#include "pandabase.h"
+#include "typedReferenceCount.h"
+#include "luse.h"
+
+#include "mouseAndKeyboard.h"
+
+
+////////////////////////////////////////////////////////////////////
+//       Class : AwMouseAndKeyboard
+// Description : Thin wrappings arround WebCore.h
+////////////////////////////////////////////////////////////////////
+class EXPCL_PANDAAWESOMIUM AwMouseAndKeyboard : public MouseAndKeyboard {
+PUBLISHED:
+  AwMouseAndKeyboard(GraphicsWindow *window, int device, const string &name);
+
+protected:
+  // Inherited from DataNode
+  virtual void do_transmit_data(DataGraphTraverser *trav,
+                                const DataNodeTransmit &input,
+                                DataNodeTransmit &output);
+
+public:
+  static TypeHandle get_class_type() {
+    return _type_handle;
+  }
+  static void init_type() {
+    MouseAndKeyboard::init_type();
+    register_type(_type_handle, "AwMouseAndKeyboard",
+                  MouseAndKeyboard::get_class_type());
+  }
+  virtual TypeHandle get_type() const {
+    return get_class_type();
+  }
+  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
+
+private:
+  static TypeHandle _type_handle;
+};
+
+#endif