You can move around a document with Click+Drag!
[ipdf/code.git] / src / screen.cpp
index 6909be2..d924c06 100644 (file)
@@ -18,6 +18,8 @@ Screen::Screen()
        }
 
        m_gl_context = SDL_GL_CreateContext(m_window);
+       
+       ResizeViewport(800, 600);
 
 }
 
@@ -55,6 +57,19 @@ bool Screen::PumpEvents()
                                break;
                        }
                        break;
+               case SDL_MOUSEMOTION:
+                       if (m_mouse_handler)
+                       {
+                               m_mouse_handler(evt.motion.x, evt.motion.y,evt.motion.state, 0);
+                       }
+                       break;
+               case SDL_MOUSEBUTTONDOWN:
+               case SDL_MOUSEBUTTONUP:
+                       if (m_mouse_handler)
+                       {
+                               m_mouse_handler(evt.button.x, evt.button.y, evt.button.state, 0);
+                       }
+                       break;
                default:
                        break;
                }
@@ -62,6 +77,23 @@ bool Screen::PumpEvents()
        return no_quit_requested;
 }
 
+void Screen::SetMouseCursor(Screen::MouseCursors cursor)
+{
+       SDL_SystemCursor system_cursor_id = SDL_SYSTEM_CURSOR_ARROW;
+       switch (cursor)
+       {
+       case CursorArrow: system_cursor_id = SDL_SYSTEM_CURSOR_ARROW; break;
+       case CursorWait: system_cursor_id = SDL_SYSTEM_CURSOR_WAIT; break;
+       case CursorWaitArrow: system_cursor_id = SDL_SYSTEM_CURSOR_WAITARROW; break;
+       case CursorMove: system_cursor_id = SDL_SYSTEM_CURSOR_SIZEALL; break;
+       case CursorHand: system_cursor_id = SDL_SYSTEM_CURSOR_HAND; break;
+       default: break;
+       }
+       SDL_Cursor *system_cursor = SDL_CreateSystemCursor(system_cursor_id);
+       SDL_SetCursor(system_cursor);
+       //TODO: Check if we need to free the system cursors.
+}
+
 void Screen::Present()
 {
        SDL_GL_SwapWindow(m_window);

UCC git Repository :: git.ucc.asn.au