- Timestamp:
- 02/04/14 03:50:28 (11 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gfx/image.cc
r128 r228 48 48 } 49 49 50 void image::fill( region r, uint8 value, int stride ) 51 { 52 if ( stride == 0 ) stride = r.size.x * static_cast<sint32>( m_depth ); 53 54 sint32 bpos = (r.pos.y*m_size.x + r.pos.x ) * static_cast<sint32>( m_depth ); 55 sint32 bline = m_size.x*static_cast<sint32>( m_depth ); 56 57 for( int i = 0; i < r.size.y; ++i ) 58 { 59 // TODO: test 60 std::fill( m_data + bpos + bline * i, m_data + bpos + bline * i + stride, value ); 61 } 62 } 63 64 50 65 void image::set_region( region r, const uint8 * data, int stride ) 51 66 { … … 64 79 } 65 80 81 void image::set_region( region r, const image_data* idata ) 82 { 83 if ( idata->get_depth() == m_depth ) 84 { 85 set_region( r, idata->get_data() ); 86 return; 87 } 88 89 fill( r, 255 ); 90 91 sint32 bpos = (r.pos.y*m_size.x + r.pos.x ) * static_cast<sint32>( m_depth ); 92 sint32 bline = m_size.x*static_cast<sint32>( m_depth ); 93 94 const uint8* data = idata->get_data(); 95 sint32 depth = idata->get_depth(); 96 sint32 dstride = r.size.x * static_cast<sint32>( depth ); 97 98 for( int y = 0; y < r.size.y; ++y ) 99 { 100 sint32 pos = bpos + bline * y; 101 for( int x = 0; x < r.size.x; ++x ) 102 { 103 sint32 xy = pos + x * m_depth; 104 for( int e = 0; e < depth; ++e ) 105 { 106 m_data[ xy + e ] = data[ y*dstride + x * depth + e ]; 107 } 108 } 109 } 110 } 111 112 66 113 image::~image() 67 114 { -
trunk/src/gl/gl_device.cc
r184 r228 15 15 using namespace nv; 16 16 17 window* gl_device::create_window( uint16 width, uint16 height )17 window* gl_device::create_window( uint16 width, uint16 height, bool fullscreen ) 18 18 { 19 return new gl_window( this, width, height );19 return new gl_window( this, width, height, fullscreen ); 20 20 } 21 21 -
trunk/src/gl/gl_window.cc
r184 r228 203 203 204 204 205 gl_window::gl_window( device* dev, uint16 width, uint16 height )205 gl_window::gl_window( device* dev, uint16 width, uint16 height, bool fullscreen ) 206 206 : m_device( dev ), m_width( width ), m_height( height ), m_title("NV Engine"), m_handle( nullptr ) 207 207 { 208 208 #if NV_SDL_VERSION == NV_SDL_12 209 209 uint32 flags = SDL_OPENGL; 210 if (fullscreen) flags |= SDL_FULLSCREEN; 210 211 m_handle = SDL_SetVideoMode( width, height, 32, flags ); 211 212 #elif NV_SDL_VERSION == NV_SDL_20 212 213 uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN; 214 if (fullscreen) flags |= SDL_FULLSCREEN; 213 215 m_handle = SDL_CreateWindow("Nova Engine", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 214 216 width, height, flags ); -
trunk/src/lua/lua_map_tile.cc
r221 r228 130 130 { 131 131 nv::uint8 c = tile->data[ y * tile->size_x + x ]; 132 if ( c != 0 ) area->set_cell( coord + nv::ivec2( x, y ), tile->data[ y * tile->size_x + x ]);132 if ( c != 0 ) area->set_cell( coord + nv::ivec2( x, y ), c ); 133 133 } 134 134 -
trunk/src/lua/lua_state.cc
r217 r228 234 234 for(; lib->func != NULL; lib++) 235 235 { 236 lib->func( m_state ); 236 lua_pushcfunction( m_state, lib->func ); 237 lua_call(m_state, 0, 1); 238 lua_setglobal( m_state, lib->name ); 237 239 } 238 240 register_nova( this );
Note: See TracChangeset
for help on using the changeset viewer.