Add Offscreen Framebuffer support
This commit is contained in:
+13
-7
@@ -21,11 +21,17 @@
|
||||
#define CP_ERR_CONT(format, ...) std::cout << TERM_RED << " " << StringFormat(format, __VA_ARGS__) << TERM_CLEAR << std::endl
|
||||
|
||||
#define CP_UNIMPLEMENTED() CP_WARN("%s is unimplemented", __FUNCTION__)
|
||||
#define CP_ABORT(format, ...) \
|
||||
do \
|
||||
{ \
|
||||
CP_ERR(format, __VA_ARGS__); \
|
||||
throw std::runtime_error(StringFormat(format, __VA_ARGS__)); \
|
||||
} while(false)
|
||||
#define CP_ASSERT(Function, format, ...) \
|
||||
do \
|
||||
do \
|
||||
{ \
|
||||
if(!(Function)) \
|
||||
{ \
|
||||
{ \
|
||||
CP_ERR(format, __VA_ARGS__); \
|
||||
throw std::runtime_error(StringFormat(format, __VA_ARGS__)); \
|
||||
} \
|
||||
@@ -40,16 +46,16 @@
|
||||
} \
|
||||
} while(false)
|
||||
#define CP_DELETE_COPY_AND_MOVE_CTOR(ClassName) \
|
||||
ClassName(ClassName&&) = delete; \
|
||||
ClassName(const ClassName&) = delete; \
|
||||
ClassName& operator=(ClassName&&) = delete; \
|
||||
ClassName& operator=(const ClassName&) = delete
|
||||
ClassName(ClassName&&) = delete; \
|
||||
ClassName(const ClassName&) = delete; \
|
||||
ClassName& operator=(ClassName&&) = delete; \
|
||||
ClassName& operator=(const ClassName&) = delete
|
||||
|
||||
template<typename ... Args>
|
||||
std::string StringFormat(const std::string& format, Args... args)
|
||||
{
|
||||
int size = std::snprintf(nullptr, 0, format.c_str(), args...) + 1;
|
||||
CP_ASSERT(size > 0, "Error during formatting");
|
||||
CP_ASSERT(size > 0, "Error during formatting");
|
||||
std::unique_ptr<char[]> buf(new char[size]);
|
||||
std::snprintf(buf.get(), size, format.c_str(), args...);
|
||||
return std::string(buf.get(), buf.get() + size - 1);
|
||||
|
||||
Reference in New Issue
Block a user