Changeset 172


Ignore:
Timestamp:
07/25/13 14:37:24 (12 years ago)
Author:
epyon
Message:
  • sdl - missing 2.0 sdl_functions
  • lua - compat implementation of lua_upvalueindex
  • position - rectangle single argument constructor made explicit
  • gl_window - fix for SDL 2.0 ascii code of key press
  • lua/glm - coord as a separate class (behaves like ivec2)
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/lib/detail/sdl_functions_20.inc

    r171 r172  
    302302NV_SDL_FUN( int , SDL_GetNumTouchFingers, (SDL_TouchID touchID) );
    303303NV_SDL_FUN( SDL_Finger * , SDL_GetTouchFinger, (SDL_TouchID touchID, int index) );
     304
     305NV_SDL_FUN( char *, SDL_getenv, (const char *name) );
     306NV_SDL_FUN( int , SDL_setenv, (const char *name, const char *value, int overwrite) );
     307NV_SDL_FUN( int , SDL_isdigit, (int x) );
     308NV_SDL_FUN( int , SDL_isspace, (int x) );
     309NV_SDL_FUN( int , SDL_toupper, (int x) );
     310NV_SDL_FUN( int , SDL_tolower, (int x) );
  • trunk/nv/lib/lua.hh

    r166 r172  
    363363
    364364extern const lua_Number* (*lua_version) (lua_State *L);
     365extern int LUA_UPVALUEINDEX;
    365366extern int LUA_REGISTRYINDEX;
    366367extern int LUA_VERSION_NUM;
     368#define lua_upvalueindex(i)    (LUA_UPVALUEINDEX-(i))
    367369#define lua_tounsigned(L,idx) (lua_Number)lua_tointeger(L,idx)
    368370#define lua_pushunsigned(L,u) lua_pushinteger(L,(lua_Integer)u)
  • trunk/nv/position.hh

    r132 r172  
    4141                 * @param p The position to assign the rectangle to.
    4242                 */
    43                 rectangle( position p ) : ul(p), lr(p) {}
     43                explicit rectangle( position p ) : ul(p), lr(p) {}
    4444               
    4545                /**
     
    152152
    153153                /**
     154                 * Gets the area of the rectangle.
     155                 *
     156                 * @returns The area of the rectangle, including the edge
     157                 */
     158                value_type get_enclosed_area() const { return (lr.y - ul.y + 1) * (lr.x - ul.x + 1); }
     159
     160                /**
    154161                 * Checks to see if the rectangle is backwards.
    155162                 *
  • trunk/src/gl/gl_window.cc

    r171 r172  
    2828        {
    2929                kevent.key.ascii = static_cast<char8>( ucode );
     30#if NV_SDL_VERSION == NV_SDL_20
     31                if (ucode >= 'a' && ucode <= 'z')
     32                {
     33                        int shifted = !!(ke.keysym.mod & KMOD_SHIFT);
     34                        int capslock = !!(ke.keysym.mod & KMOD_CAPS);
     35                        if ((shifted ^ capslock) != 0) {
     36                                kevent.key.ascii = SDL_toupper(ucode);
     37                        }
     38                }
     39#endif
    3040        }
    3141
  • trunk/src/lib/lua.cc

    r166 r172  
    4545#       include <nv/lib/detail/lua_functions_compat.inc>
    4646#       undef NV_LUA_COMPAT_FUN
     47int LUA_UPVALUEINDEX  = 0;
    4748int LUA_REGISTRYINDEX = 0;
    4849int LUA_VERSION_NUM   = 0;
     
    266267                NV_LUA_LOAD( luaL_getsubtable );
    267268
     269                LUA_UPVALUEINDEX  = LUA_REGISTRYINDEX_52;
    268270                LUA_REGISTRYINDEX = LUA_REGISTRYINDEX_52;
    269271                LUA_VERSION_NUM   = 502;
     
    292294                NV_LUA_LOAD( lua_equal );
    293295                lua_compare       = lua_compare_51;
     296                LUA_UPVALUEINDEX  = LUA_GLOBALSINDEX_51;
    294297                LUA_REGISTRYINDEX = LUA_REGISTRYINDEX_51;
    295298                LUA_VERSION_NUM   = 501;
  • trunk/src/lua/lua_glm.cc

    r121 r172  
    340340        int stack = lua_gettop( L );
    341341
     342        luaL_requiref(L, "coord", luaopen_vec<nv::ivec2>, 1);
    342343        luaL_requiref(L, "ivec2", luaopen_vec<nv::ivec2>, 1);
    343344        luaL_requiref(L, "ivec3", luaopen_vec<nv::ivec3>, 1);
Note: See TracChangeset for help on using the changeset viewer.