diff options
author | 2015-02-14 12:53:08 +0100 | |
---|---|---|
committer | 2015-02-14 12:53:08 +0100 | |
commit | 8afe66fc634116a654becad7d9f7f53ab199da41 (patch) | |
tree | 8c3b7889cba36cbcd2b9d6d8d6b3df87dd495cb2 /3rdparty/bgfx/examples/common/entry/entry.cpp | |
parent | 20b68364f7fa3bf692e50504fecf9bc5825eada3 (diff) |
Updated BGFX, BX and GENie to latest (nw)
Diffstat (limited to '3rdparty/bgfx/examples/common/entry/entry.cpp')
-rw-r--r-- | 3rdparty/bgfx/examples/common/entry/entry.cpp | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/3rdparty/bgfx/examples/common/entry/entry.cpp b/3rdparty/bgfx/examples/common/entry/entry.cpp index 3b4a49410f5..947d4204666 100644 --- a/3rdparty/bgfx/examples/common/entry/entry.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry.cpp @@ -22,7 +22,17 @@ namespace entry static bool s_exit = false; static bx::FileReaderI* s_fileReader = NULL; static bx::FileWriterI* s_fileWriter = NULL; - static bx::CrtAllocator s_allocator; + + extern bx::ReallocatorI* getDefaultAllocator(); + static bx::ReallocatorI* s_allocator = getDefaultAllocator(); + +#if ENTRY_CONFIG_IMPLEMENT_DEFAULT_ALLOCATOR + bx::ReallocatorI* getDefaultAllocator() + { + static bx::CrtAllocator s_allocator; + return &s_allocator; + } +#endif // ENTRY_CONFIG_IMPLEMENT_DEFAULT_ALLOCATOR bool setOrToggle(uint32_t& _flags, const char* _name, uint32_t _bit, int _first, int _argc, char const* const* _argv) { @@ -137,10 +147,12 @@ namespace entry s_fileWriter = new bx::CrtFileWriter; #endif // BX_CONFIG_CRT_FILE_READER_WRITER + cmdInit(); cmdAdd("mouselock", cmdMouseLock); cmdAdd("graphics", cmdGraphics ); cmdAdd("exit", cmdExit ); + inputInit(); inputAddBindings("bindings", s_bindings); entry::WindowHandle defaultWindow = { 0 }; @@ -148,6 +160,11 @@ namespace entry int32_t result = ::_main_(_argc, _argv); + inputRemoveBindings("bindings"); + inputShutdown(); + + cmdShutdown(); + #if BX_CONFIG_CRT_FILE_READER_WRITER delete s_fileReader; s_fileReader = NULL; @@ -448,7 +465,20 @@ namespace entry bx::ReallocatorI* getAllocator() { - return &s_allocator; + return s_allocator; + } + + void* TinyStlAllocator::static_allocate(size_t _bytes) + { + return BX_ALLOC(getAllocator(), _bytes); + } + + void TinyStlAllocator::static_deallocate(void* _ptr, size_t /*_bytes*/) + { + if (NULL != _ptr) + { + BX_FREE(getAllocator(), _ptr); + } } } // namespace entry |