00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef IPHONEGRAPHICSWINDOW_H
00016 #define IPHONEGRAPHICSWINDOW_H
00017
00018 #include "pandabase.h"
00019 #include "graphicsWindow.h"
00020 #include "buttonHandle.h"
00021 #include "glesgsg.h"
00022 #import "eaglView.h"
00023
00024 #import <UIKit/UIKit.h>
00025
00026
00027
00028
00029
00030
00031 class IPhoneGraphicsWindow : public GraphicsWindow {
00032 public:
00033 IPhoneGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
00034 const string &name,
00035 const FrameBufferProperties &fb_prop,
00036 const WindowProperties &win_prop,
00037 int flags,
00038 GraphicsStateGuardian *gsg,
00039 GraphicsOutput *host);
00040 virtual ~IPhoneGraphicsWindow();
00041
00042 virtual bool begin_frame(FrameMode mode, Thread *current_thread);
00043 virtual void end_frame(FrameMode mode, Thread *current_thread);
00044 virtual void begin_flip();
00045 virtual void end_flip();
00046 virtual void process_events();
00047
00048 virtual void set_properties_now(WindowProperties &properties);
00049 virtual void clear_pipe();
00050
00051 void rotate_window();
00052 void touches_began(NSSet *touches, UIEvent *event);
00053 void touches_moved(NSSet *touches, UIEvent *event);
00054 void touches_ended(NSSet *touches, UIEvent *event);
00055 void touches_cancelled(NSSet *touches, UIEvent *event);
00056
00057 CGPoint get_average_location(NSSet *touches);
00058
00059
00060 protected:
00061 virtual void close_window();
00062 virtual bool open_window();
00063
00064 private:
00065 void set_pointer_in_window(int x, int y);
00066 void set_pointer_out_of_window();
00067 void handle_button_delta(int num_touches);
00068
00069 private:
00070 EAGLView *_gl_view;
00071 int _last_buttons;
00072
00073 public:
00074 static TypeHandle get_class_type() {
00075 return _type_handle;
00076 }
00077 static void init_type() {
00078 GraphicsWindow::init_type();
00079 register_type(_type_handle, "IPhoneGraphicsWindow",
00080 GraphicsWindow::get_class_type());
00081 }
00082 virtual TypeHandle get_type() const {
00083 return get_class_type();
00084 }
00085 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00086
00087 private:
00088 static TypeHandle _type_handle;
00089 };
00090
00091 #include "iPhoneGraphicsWindow.I"
00092
00093 #endif