Panda3D
iPhoneGraphicsWindow.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file iPhoneGraphicsWindow.h
10  * @author drose
11  * @date 2009-04-08
12  */
13 
14 #ifndef IPHONEGRAPHICSWINDOW_H
15 #define IPHONEGRAPHICSWINDOW_H
16 
17 #include "pandabase.h"
18 #include "graphicsWindow.h"
19 #include "buttonHandle.h"
20 #include "glesgsg.h"
21 #import "eaglView.h"
22 
23 #import <UIKit/UIKit.h>
24 
25 /**
26  * An interface to the osx/ system for managing GL windows under X.
27  */
29 public:
31  const std::string &name,
32  const FrameBufferProperties &fb_prop,
33  const WindowProperties &win_prop,
34  int flags,
36  GraphicsOutput *host);
37  virtual ~IPhoneGraphicsWindow();
38 
39  virtual bool begin_frame(FrameMode mode, Thread *current_thread);
40  virtual void end_frame(FrameMode mode, Thread *current_thread);
41  virtual void begin_flip();
42  virtual void end_flip();
43  virtual void process_events();
44 
45  virtual void set_properties_now(WindowProperties &properties);
46  virtual void clear_pipe();
47 
48  void rotate_window();
49  void touches_began(NSSet *touches, UIEvent *event);
50  void touches_moved(NSSet *touches, UIEvent *event);
51  void touches_ended(NSSet *touches, UIEvent *event);
52  void touches_cancelled(NSSet *touches, UIEvent *event);
53 
54  CGPoint get_average_location(NSSet *touches);
55 
56 
57 protected:
58  virtual void close_window();
59  virtual bool open_window();
60 
61 private:
62  void set_pointer_in_window(int x, int y);
63  void set_pointer_out_of_window();
64  void handle_button_delta(int num_touches);
65 
66 private:
67  EAGLView *_gl_view;
68  int _last_buttons;
69 
70 public:
71  static TypeHandle get_class_type() {
72  return _type_handle;
73  }
74  static void init_type() {
75  GraphicsWindow::init_type();
76  register_type(_type_handle, "IPhoneGraphicsWindow",
77  GraphicsWindow::get_class_type());
78  }
79  virtual TypeHandle get_type() const {
80  return get_class_type();
81  }
82  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
83 
84 private:
85  static TypeHandle _type_handle;
86 };
87 
88 #include "iPhoneGraphicsWindow.I"
89 
90 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
This class is the main interface to controlling the render process.
This is a base class for the various different classes that represent the result of a frame of render...
An object to create GraphicsOutputs that share a particular 3-D API.
Definition: graphicsPipe.h:52
Encapsulates all the communication with a particular instance of a given rendering backend.
A window, fullscreen or on a desktop, into which a graphics device sends its output for interactive d...
An interface to the osx/ system for managing GL windows under X.
virtual void begin_flip()
This function will be called within the draw thread after end_frame() has been called on all windows,...
virtual void process_events()
Do whatever processing is necessary to ensure that the window responds to user events.
virtual void set_properties_now(WindowProperties &properties)
Applies the requested set of properties to the window, if possible, for instance to request a change ...
virtual void clear_pipe()
Sets the window's _pipe pointer to NULL; this is generally called only as a precursor to deleting the...
virtual void end_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread after rendering is completed for a given frame.
virtual bool begin_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread before beginning rendering for a given frame.
virtual void end_flip()
This function will be called within the draw thread after begin_flip() has been called on all windows...
A thread; that is, a lightweight process.
Definition: thread.h:46
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
A container for the various kinds of properties we might ask to have on a graphics window before we o...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22