Ignore:
Timestamp:
08/26/14 18:39:10 (11 years ago)
Author:
epyon
Message:
  • window_manager interface added
  • input interface added
  • sdl::window_manager and sdl::input added
  • gl_device/gl_window/gl_context made oblivious to sdl
  • currently some setup is required, application class needed
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gl/gl_device.cc

    r323 r326  
    77#include "nv/gl/gl_window.hh"
    88#include "nv/core/logging.hh"
    9 #include "nv/lib/sdl.hh"
    109#include "nv/lib/sdl_image.hh"
    1110#include "nv/gl/gl_enum.hh"
     
    1413using namespace nv;
    1514
    16 window* gl_device::create_window( uint16 width, uint16 height, bool fullscreen )
    17 {
    18         return new gl_window( this, width, height, fullscreen );
    19 }
    20 
    21 window* nv::gl_device::adopt_window( void* sys_w_handle, void* sys_dc )
    22 {
    23         return new gl_window( this, sys_w_handle, sys_dc );
    24 }
    25 
    26 
    27 
    2815gl_device::gl_device()
    2916{
    30         nv::load_sdl_library();
    31         m_info = NULL;
    32 
    33         if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_JOYSTICK ) < 0 )
    34         {
    35                 NV_LOG( LOG_CRITICAL, "Video initialization failed: " << SDL_GetError( ) );
    36                 return; // TODO: Error report
    37         }
    38 
    39 #if NV_SDL_VERSION == NV_SDL_12
    40         m_info = SDL_GetVideoInfo( );
    41 
    42         if ( !m_info )
    43         {
    44                 NV_LOG( LOG_CRITICAL, "Video query failed: " << SDL_GetError( ) );
    45                 return; // TODO: Error report
    46         }
    47 #endif
    48 
    4917        m_shader_header  = "#version 120\n";
    5018        for ( auto& i : get_uniform_factory() )
     
    6735// this is a temporary function that will be removed once we find a way to
    6836// pass binary file data around
    69 image_data* nv::gl_device::create_image_data( const std::string& filename )
     37image_data* gl_device::create_image_data( const std::string& filename )
    7038{
    7139        load_sdl_image_library();
     
    8351}
    8452
    85 uint32 gl_device::get_ticks()
    86 {
    87         return SDL_GetTicks();
    88 }
    89 
    90 void gl_device::delay( uint32 ms )
    91 {
    92         return SDL_Delay( ms );
    93 }
    9453
    9554gl_device::~gl_device()
     
    10160        while ( m_programs.size() > 0 )
    10261                release( m_programs.get_handle(0) );
    103         SDL_Quit();
    10462}
    10563
Note: See TracChangeset for help on using the changeset viewer.