demotool/ui-utilities.hh

50 lines
1.2 KiB
C++
Raw Normal View History

#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( ); \
})