enable widget debug outline when BWIDGETS_DEBUG is defined

This commit is contained in:
Andrea Blankenstijn 2021-08-14 12:05:24 +02:00
parent b11d574d9c
commit 6ba5d7fc1c
2 changed files with 6 additions and 3 deletions

View File

@ -4,7 +4,6 @@ project('sdl2_basic_widgets', 'cpp',
# 'b_lundef=false',
# 'b_sanitize=address,undefined',
'cpp_std=c++20',
'd_ndebug=if-release',
'optimization=g',
'warning_level=3',
],
@ -12,6 +11,10 @@ project('sdl2_basic_widgets', 'cpp',
add_project_arguments('-pedantic', '-Winline', language: 'cpp')
if (get_option('buildtype').startswith('debug'))
add_project_arguments('-DBWIDGETS_DEBUG', language: 'cpp')
endif
sdl = [
dependency('sdl2', version: '>=2.0.5'),
dependency('SDL2_ttf')

View File

@ -40,11 +40,11 @@ auto Widget::render() -> Widget*
{
if (_renderer == nullptr) return this;
#ifndef _NDEBUG
#ifdef BWIDGETS_DEBUG
_renderer
->draw_color({
// NOLINTNEXTLINE(readability-magic-numbers)
{0, 255, 0, SDL_ALPHA_TRANSPARENT}
{0, 255, 0, SDL_ALPHA_OPAQUE}
})
->draw_rect(nullptr);
#endif