Changeset 228 for trunk/src


Ignore:
Timestamp:
02/04/14 03:50:28 (11 years ago)
Author:
epyon
Message:
  • various untracked changes
Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gfx/image.cc

    r128 r228  
    4848}
    4949
     50void 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
    5065void image::set_region( region r, const uint8 * data, int stride )
    5166{
     
    6479}
    6580
     81void 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
    66113image::~image()
    67114{
  • trunk/src/gl/gl_device.cc

    r184 r228  
    1515using namespace nv;
    1616
    17 window* gl_device::create_window( uint16 width, uint16 height )
     17window* gl_device::create_window( uint16 width, uint16 height, bool fullscreen )
    1818{
    19         return new gl_window( this, width, height );
     19        return new gl_window( this, width, height, fullscreen );
    2020}
    2121
  • trunk/src/gl/gl_window.cc

    r184 r228  
    203203
    204204
    205 gl_window::gl_window( device* dev, uint16 width, uint16 height )
     205gl_window::gl_window( device* dev, uint16 width, uint16 height, bool fullscreen )
    206206        : m_device( dev ), m_width( width ), m_height( height ), m_title("NV Engine"), m_handle( nullptr )
    207207{
    208208#if NV_SDL_VERSION == NV_SDL_12
    209209        uint32 flags = SDL_OPENGL;
     210        if (fullscreen) flags |= SDL_FULLSCREEN;
    210211        m_handle = SDL_SetVideoMode( width, height, 32, flags );
    211212#elif NV_SDL_VERSION == NV_SDL_20
    212213        uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;
     214        if (fullscreen) flags |= SDL_FULLSCREEN;
    213215        m_handle = SDL_CreateWindow("Nova Engine", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
    214216                width, height, flags );
  • trunk/src/lua/lua_map_tile.cc

    r221 r228  
    130130                {
    131131                        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 );
    133133                }
    134134
  • trunk/src/lua/lua_state.cc

    r217 r228  
    234234                for(; lib->func != NULL; lib++)
    235235                {
    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 );
    237239                }
    238240                register_nova( this );
Note: See TracChangeset for help on using the changeset viewer.