00001
00002
00003 #ifndef NV_PLATFORM_CONTEXT_H
00004 #define NV_PLATFORM_CONTEXT_H
00005
00006 #include <NvFoundation.h>
00007 #include <vector>
00008 #include "NvKeyboard.h"
00009
00012
00013 class NvGamepad;
00014
00016 struct NvPointerActionType {
00017 enum Enum {
00018 UP = 0,
00019 DOWN = 1,
00020 MOTION = 2,
00021 EXTRA_DOWN = 4,
00022 EXTRA_UP = 8
00023 };
00024 };
00025
00027 struct NvKeyActionType {
00028 enum Enum {
00029 UP = 0,
00030 DOWN = 1,
00031 REPEAT = 2
00032 };
00033 };
00034
00036 struct NvInputDeviceType {
00037 enum Enum {
00038 MOUSE,
00039 TOUCH,
00040 STYLUS
00041 };
00042 };
00043
00045 struct NvPointerModifierType {
00046 enum Enum {
00047 SHIFT = 0x00000001,
00048 CTRL = 0x00000002,
00049 ALT = 0x00000004,
00050 };
00051 };
00052
00055 struct NvMouseButton {
00056 const static uint32_t LEFT = 0x00000001;
00057 const static uint32_t RIGHT = 0x00000002;
00058 const static uint32_t MIDDLE = 0x00000004;
00059 };
00060
00062 class NvPointerEvent {
00063 public:
00064 float m_x;
00065 float m_y;
00066 uint32_t m_id;
00067 };
00068
00070 class NvInputCallbacks
00071 {
00072 public:
00083 virtual bool pointerInput(NvInputDeviceType::Enum device,
00084 NvPointerActionType::Enum action,
00085 uint32_t modifiers,
00086 int32_t count, NvPointerEvent* points) = 0;
00087
00095 virtual bool keyInput(uint32_t code, NvKeyActionType::Enum action) = 0;
00096
00102 virtual bool characterInput(uint8_t c) = 0;
00103
00110 virtual bool gamepadChanged(uint32_t changedPadFlags) = 0;
00111 };
00112
00117 class NvPlatformContext {
00118 public:
00124 virtual bool isAppRunning() = 0;
00125
00130 virtual void requestExit() = 0;
00131
00139 virtual bool pollEvents(NvInputCallbacks* callbacks) = 0;
00140
00147 virtual bool isContextLost() = 0;
00148
00154 virtual bool shouldRender() = 0;
00155
00159 virtual bool hasWindowResized() = 0;
00160
00165 virtual NvGamepad* getGamepad() = 0;
00166
00171 virtual void setAppTitle(const char* title) = 0;
00172
00178 virtual const std::vector<const char*>& getCommandLine() = 0;
00179 };
00180
00181 #endif