Changeset 120
- Timestamp:
- 06/15/13 02:05:49 (12 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv.lua
r2 r120 1 -- project definition for nv2 1 project "nv" 3 2 location (_ACTION) 4 3 language "C++" 5 4 kind "StaticLib" 6 5 includedirs { "." } 7 6 files { "nv/**.hh", "nv/**.inl", "src/**.cc" } 8 7 targetname "nv" 8 9 -- injection! 10 solution( solution().name ) 11 configuration "*" 12 includedirs { os.getenv("GLM_PATH") } 13 configuration "gmake" 14 buildoptions "-std=c++0x" 15 configuration "vs*" 16 defines { "_SECURE_SCL=0", "_CRT_SECURE_NO_WARNINGS=1" } 17 18 if _ACTION == "gmake-clang" then 19 premake.gcc.cc = "clang" 20 premake.gcc.cxx = "clang++" 21 _ACTION = "gmake" 22 end 23 24 premake.action.add { 25 trigger = "gmake-clang", 26 description = "gmake file with clang overrides, needs 'make -R' to work", 27 } 28 29 if _ACTION == "clean" then 30 for action in premake.action.each() do 31 os.rmdir(action.trigger) 32 end 33 end -
trunk/nv/common.hh
r117 r120 48 48 #define NV_COMPILER NV_MSVC 49 49 #define NV_COMP_VER _MSC_VER 50 #elif defined( __clang__ ) 51 #define NV_COMPILER NV_CLANG 52 #define NV_COMP_VER (((__clang_major__)*100) + (__clang_minor__*10) + __clang_patchlevel__) 50 53 #elif defined( __GNUC__ ) 51 54 #define NV_COMPILER NV_GNUC 52 55 #define NV_COMP_VER (((__GNUC__)*100) + (__GNUC_MINOR__*10) + __GNUC_PATCHLEVEL__) 53 #elif defined( __clang__ )54 #define NV_COMPILER NV_CLANG55 #define NV_COMP_VER (((__clang_major__)*100) + (__clang_minor__*10) + __clang_patchlevel__)56 56 #else 57 57 #error "Unknown compiler!" -
trunk/nv/gfx/cached_buffer.hh
r119 r120 47 47 if ( locked || result ) 48 48 { 49 m_cache->add_offset<T>( m_data.size(), m_offset, static_cast<T>(value) ); 49 // funny, but this is what GCC expects 50 m_cache->template add_offset<T>( m_data.size(), m_offset, static_cast<T>(value) ); 50 51 } 51 52 return result; -
trunk/nv/interface/clear_state.hh
r111 r120 64 64 }; 65 65 66 scissor_test scissor_test;67 color_mask color_mask;66 nv::scissor_test scissor_test; 67 nv::color_mask color_mask; 68 68 bool depth_mask; 69 69 uint32 front_stencil_mask; -
trunk/nv/position.hh
r115 r120 29 29 typedef rectangle type; 30 30 31 union 32 { 33 struct { position upper_left; position lower_right; }; 34 struct { position ul; position lr; }; 35 struct { value_type x1,y1,x2,y2; }; 36 }; 31 position ul; 32 position lr; 37 33 /** 38 34 *Creates a new rectangle assigned to {0, 0, 0, 0}. … … 139 135 *@returns The width of the rectangle. 140 136 */ 141 value_type get_width() const { return x2 - x1; }137 value_type get_width() const { return lr.x - ul.x; } 142 138 143 139 /** … … 146 142 *@returns The height of the rectangle. 147 143 */ 148 value_type get_height() const { return y2 - y1; }144 value_type get_height() const { return lr.y - ul.y; } 149 145 150 146 /** … … 153 149 *@returns The area of the rectangle. 154 150 */ 155 value_type get_area() const { return ( y2 - y1) * (x2 - x1); }151 value_type get_area() const { return (lr.y - ul.y) * (lr.x - ul.x); } 156 152 157 153 /** … … 160 156 *@returns True if the rectangle's upper-left is above and left (or equal to) the rectangle's lower-right, false if it is not. 161 157 */ 162 bool is_valid() const { return x2 >= x1 && y2 >= y1; }158 bool is_valid() const { return lr.x >= ul.x && lr.y >= ul.y; } 163 159 164 160 /** … … 246 242 *@returns True if the position is inside or on the edge of the rectangle, false otherwise. 247 243 */ 248 bool contains( const position& r ) const{ return y2 >= r.y && y1 <= r.y && x2 >= r.x && x1<= r.x; }244 bool contains( const position& r ) const{ return lr.y >= r.y && ul.y <= r.y && lr.x >= r.x && ul.x <= r.x; } 249 245 250 246 /** … … 262 258 *@returns True if any part of the rectangle to check overlaps this rectangle, false otherwise. 263 259 */ 264 bool collides( const rectangle& r ) const { return y2 > r.y1 && y1 < r.y2 && x2 > r.x1 && x1 < r.x2; }260 bool collides( const rectangle& r ) const { return lr.y > r.ul.y && ul.y < r.lr.y && lr.x > r.ul.x && ul.x < r.lr.x; } 265 261 266 262 /** … … 298 294 void repair() 299 295 { 300 if ( x1 > x2) std::swap( x1, x2);301 if ( y1 > y2) std::swap( y1, y2);296 if (ul.x > lr.x) std::swap( ul.x, lr.x ); 297 if (ul.y > lr.y) std::swap( ul.y, lr.y ); 302 298 } 303 299 -
trunk/premake4.lua
r17 r120 1 -- Error handling if user didn't provide any action/target2 -- for the build3 if _ACTION == nil then4 print "Error! You must specify target build"5 print "Example: ./premake4 gmake"6 print " This will create makefiles for Linux"7 print ""8 print "Aborting!"9 print ""10 return11 end12 13 1 solution "nv" 14 2 configurations { "debug", "release" } 15 16 -- For starters, check the target build.17 -- If this is a gmake build we must add these18 -- flags to enable C++11 support.19 if _ACTION == "gmake" then20 buildoptions "-std=c++11"21 end22 23 3 targetdir "bin" 24 4 flags { "ExtraWarnings", "NoPCH" } … … 29 9 flags { "Symbols" } 30 10 targetdir "bin" 31 objdir (_ACTION .."/debug")11 objdir (_ACTION or "".."/debug") 32 12 33 13 configuration "release" … … 35 15 flags { "Optimize" } 36 16 targetdir "bin" 37 objdir (_ACTION .."/release")17 objdir (_ACTION or "".."/release") 38 18 39 19 dofile("nv.lua") … … 46 26 end 47 27 } 48 49 if _ACTION == "clean" then50 for action in premake.action.each() do51 os.rmdir(action.trigger)52 end53 end54 -
trunk/src/gl/gl_device.cc
r98 r120 74 74 load_sdl_image_library(); 75 75 SDL_Surface* image = IMG_Load( filename.c_str() ); 76 if (!image) 77 { 78 NV_LOG( LOG_ERROR, "Image file " << filename.c_str() << " not found!" ); 79 return nullptr; 80 } 76 81 image_data* data = new image_data( glm::ivec2( image->w, image->h ), image->format->BytesPerPixel, (nv::uint8*)image->pixels ); 77 82 return data; -
trunk/src/gui/gui_element.cc
r99 r120 27 27 } 28 28 } 29 //((environment*)m_root)->update( this, elapsed ); 29 30 } 30 31 … … 90 91 } 91 92 92 m_absolute = m_relative + pabsolute.u pper_left;93 m_absolute = m_relative + pabsolute.ul; 93 94 94 95 for ( object* o : *this ) -
trunk/src/library.cc
r113 r120 115 115 #if NV_PLATFORM == NV_WINDOWS 116 116 // We do hate WinAPI for code like this, don't we? 117 LP VOID buffer;117 LPTSTR buffer = NULL; 118 118 FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 119 119 NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &buffer, 0, NULL ); -
trunk/src/object.cc
r107 r120 7 7 #include "nv/object.hh" 8 8 9 #include <algorithm> 9 10 #include "nv/root.hh" 10 11 #include "nv/types.hh" -
trunk/tests/render_test/premake4.lua
r61 r120 1 if _ACTION == nil then2 print "Error! You must specify target build"3 print "Example: ./premake4 gmake"4 print " This will create makefiles for Linux"5 print ""6 print "Aborting!"7 print ""8 return9 end10 11 1 solution "nv_render_test" 12 2 configurations { "debug", "release" } … … 15 5 flags { "ExtraWarnings", "NoPCH" } 16 6 17 -- For starters, check the target build.18 -- If this is a gmake build we must add these19 -- flags to enable C++11 support.20 if _ACTION == "gmake" then21 buildoptions "-std=c++11"22 end23 24 7 configuration "debug" 25 8 defines { "DEBUG" } 26 9 flags { "Symbols", "StaticRuntime" } 27 objdir (_ACTION .."/debug")10 objdir (_ACTION or "".."/debug") 28 11 29 12 configuration "release" 30 13 defines { "NDEBUG" } 31 14 flags { "Optimize", "StaticRuntime" } 32 objdir (_ACTION .."/release")15 objdir (_ACTION or "".."/release") 33 16 34 17 dofile("render_test.lua") -
trunk/tests/render_test/render_test.lua
r46 r120 5 5 includedirs { "../../" } 6 6 targetname "rl" 7 defines { "_SCL_SECURE_NO_WARNINGS" }8 7 links { "nv" } 9 8
Note: See TracChangeset
for help on using the changeset viewer.