demotool/ui-utilities.hh
2017-11-23 14:43:15 +01:00

49 lines
1.2 KiB
C++

#pragma once
#ifndef REAL_BUILD
# include "externals.hh"
#endif
/*= UI UTILITIES =============================================================*/
namespace ImGui {
// Disable next ImGui controls
void PushDisabled( ) noexcept;
// Re-enable ImGui buttons
void PopDisabled( ) noexcept;
/*--------------------------------------------------------------------*/
// Display a menu item with a checkbox
bool MenuItemCheckbox(
char const* name ,
bool* checked ) noexcept;
/*--------------------------------------------------------------------*/
// Display a separator for the toolbar
void ToolbarSeparator( ) noexcept;
// Display a toolbar button
bool ToolbarButton(
char const* const string ,
ImVec2 const& size ,
char const* const tooltip = nullptr ,
bool enabled = true ) noexcept;
} // namespace ImGui
/*----------------------------------------------------------------------------*/
#define GL_CHECK( FAIL ) \
do { \
auto err_( glGetError( ) ); \
if ( err_ != GL_NO_ERROR ) FAIL; \
} while ( 0 )
#define GL_ASSERT( ) \
GL_CHECK({ \
fprintf( stderr , "GL error %x in %s:%d\n" , \
err_ , __FILE__ , __LINE__ ); \
abort( ); \
})