@ -363,6 +363,7 @@ class Sdl2Application {
} ;
} ;
class Configuration ;
class Configuration ;
class GLConfiguration ;
class InputEvent ;
class InputEvent ;
class KeyEvent ;
class KeyEvent ;
class MouseEvent ;
class MouseEvent ;
@ -373,29 +374,40 @@ class Sdl2Application {
class TextEditingEvent ;
class TextEditingEvent ;
/**
/**
* @ brief Default constructor
* @ brief Construct with given configuration for OpenGL context
* @ param arguments Application arguments
* @ param arguments Application arguments
* @ param configuration Configuration
* @ param configuration Application configuration
* @ param glConfiguration OpenGL context configuration
*
*
* Creates application with default or user - specified configuration .
* Creates application with default or user - specified configuration .
* See @ ref Configuration for more information . The program exits if
* See @ ref Configuration for more information . The program exits if
* the context cannot be created , see @ ref tryCreateContext ( ) for an
* the context cannot be created , see @ ref tryCreate ( ) for an
* alternative .
* alternative .
*/
*/
# ifdef DOXYGEN_GENERATING_OUTPUT
explicit Sdl2Application ( const Arguments & arguments , const Configuration & configuration , const GLConfiguration & glConfiguration ) ;
explicit Sdl2Application ( const Arguments & arguments , const Configuration & configuration = Configuration ( ) ) ;
# else
/**
/* To avoid "invalid use of incomplete type" */
* @ brief Construct with given configuration and default OpenGL context
*
* Equivalent to calling @ ref Sdl2Application ( const Arguments & , const Configuration & , const GLConfiguration & )
* with default - constructed @ ref GLConfiguration .
*/
explicit Sdl2Application ( const Arguments & arguments , const Configuration & configuration ) ;
explicit Sdl2Application ( const Arguments & arguments , const Configuration & configuration ) ;
/**
* @ brief Construct with default configuration
*
* Equivalent to calling @ ref Sdl2Application ( const Arguments & , const Configuration & )
* with default - constructed @ ref Configuration .
*/
explicit Sdl2Application ( const Arguments & arguments ) ;
explicit Sdl2Application ( const Arguments & arguments ) ;
# endif
/**
/**
* @ brief Constructor
* @ brief Construct with out c reating a window
* @ param arguments Application arguments
* @ param arguments Application arguments
*
*
* Unlike above , the context is not created and must be created later
* Unlike above , the window is not created and must be created later
* with @ ref createContext ( ) or @ ref tryCreateContext ( ) .
* with @ ref create ( ) or @ ref tryCreate ( ) .
*/
*/
explicit Sdl2Application ( const Arguments & arguments , NoCreateT ) ;
explicit Sdl2Application ( const Arguments & arguments , NoCreateT ) ;
@ -462,33 +474,78 @@ class Sdl2Application {
~ Sdl2Application ( ) ;
~ Sdl2Application ( ) ;
/**
/**
* @ brief Create context with given configuration
* @ brief Create a window with given configuration for OpenGL context
* @ param configuration Application configuration
* @ param glConfiguration OpenGL context configuration
*
*
* Must be called if and only if the context wasn ' t created by the
* Must be called only if the context wasn ' t created by the constructor
* constructor itself . Error message is printed and the program exit s
* itself , i . e . when passing @ ref NoCreate to it . Error message i s
* if the context cannot be created , see @ ref tryCreateContext ( ) for an
* printed and the program exits if the context cannot be created , see
* alternative .
* @ ref tryCreate ( ) for an alternative .
*
*
* On desktop GL , if version is not specified in @ p configuration , the
* On desktop GL , if version is not specified in @ p glConfiguration ,
* application first tries to create core context ( OpenGL 3.2 + on
* the application first tries to create core context ( OpenGL 3.2 + on
* macOS , OpenGL 3.1 + elsewhere ) and if that fails , falls back to
* macOS , OpenGL 3.1 + elsewhere ) and if that fails , falls back to
* compatibility OpenGL 2.1 context .
* compatibility OpenGL 2.1 context .
*/
*/
# ifdef DOXYGEN_GENERATING_OUTPUT
void create ( const Configuration & configuration , const GLConfiguration & glConfiguration ) ;
void createContext ( const Configuration & configuration = Configuration ( ) ) ;
# else
/**
/* To avoid "invalid use of incomplete type" */
* @ brief Create a window with given configuration and default OpenGL context
void createContext ( const Configuration & configuration ) ;
*
void createContext ( ) ;
* Equivalent to calling @ ref create ( const Configuration & , const GLConfiguration & )
* with default - constructed @ ref GLConfiguration .
*/
void create ( const Configuration & configuration ) ;
/**
* @ brief Create a window with default configuration and OpenGL context
*
* Equivalent to calling @ ref create ( const Configuration & ) with
* default - constructed @ ref Configuration .
*/
void create ( ) ;
# ifdef MAGNUM_BUILD_DEPRECATED
/** @brief @copybrief create(const Configuration&, const GLConfiguration&)
* @ deprecated Use @ ref create ( const Configuration & , const GLConfiguration & ) instead .
*/
CORRADE_DEPRECATED ( " use create(const Configuration&, const GLConfiguration&) instead " ) void createContext ( const Configuration & configuration ) {
create ( configuration ) ;
}
/** @brief @copybrief create()
* @ deprecated Use @ ref create ( ) instead .
*/
CORRADE_DEPRECATED ( " use create() instead " ) void createContext ( ) {
create ( ) ;
}
# endif
# endif
/**
* @ brief Try to create context with given configuration for OpenGL context
*
* Unlike @ ref create ( ) returns @ cpp false @ ce if the context cannot be
* created , @ cpp true @ ce otherwise .
*/
bool tryCreate ( const Configuration & configuration , const GLConfiguration & glConfiguration ) ;
/**
/**
* @ brief Try to create context with given configuration
* @ brief Try to create context with given configuration
*
*
* Unlike @ ref createContext ( ) returns @ cpp false @ ce if the context
* Unlike @ ref create ( const Configuration & ) returns @ cpp false @ ce if
* cannot be created , @ cpp true @ ce otherwise .
* the context cannot be created , @ cpp true @ ce otherwise .
*/
bool tryCreate ( const Configuration & configuration ) ;
# ifdef MAGNUM_BUILD_DEPRECATED
/** @brief @copybrief tryCreate(const Configuration&, const GLConfiguration&)
* @ deprecated Use @ ref tryCreate ( const Configuration & , const GLConfiguration & ) instead .
*/
*/
bool tryCreateContext ( const Configuration & configuration ) ;
CORRADE_DEPRECATED ( " use tryCreate(const Configuration&, const GLConfiguration&) instead " ) bool tryCreateContext ( const Configuration & configuration ) {
return tryCreate ( configuration ) ;
}
# endif
/** @{ @name Screen handling */
/** @{ @name Screen handling */
@ -773,13 +830,13 @@ class Sdl2Application {
} ;
} ;
/**
/**
@ brief C onfiguration
@ brief OpenGL context c onfiguration
The created window is always with double - buffered OpenGL context and 24 bit
The created window is always with double - buffered OpenGL context and 24 bit
depth buffer .
depth buffer .
@ see @ ref Sdl2Application ( ) , @ ref createContext ( ) , @ ref tryCreateContext ( )
@ see @ ref Sdl2Application ( ) , @ ref create ( ) , @ ref tryCreate ( )
*/
*/
class Sdl2Application : : Configuration {
class Sdl2Application : : GL Configuration {
public :
public :
# ifndef CORRADE_TARGET_EMSCRIPTEN
# ifndef CORRADE_TARGET_EMSCRIPTEN
/**
/**
@ -813,6 +870,124 @@ class Sdl2Application::Configuration {
# endif
# endif
# endif
# endif
explicit GLConfiguration ( ) ;
~ GLConfiguration ( ) ;
# ifndef CORRADE_TARGET_EMSCRIPTEN
/**
* @ brief Context flags
*
* @ note Not available in @ ref CORRADE_TARGET_EMSCRIPTEN " Emscripten " .
*/
Flags flags ( ) const { return _flags ; }
/**
* @ brief Set context flags
* @ return Reference to self ( for method chaining )
*
* Default is no flag . See also @ ref GL : : Context : : flags ( ) .
* @ note Not available in @ ref CORRADE_TARGET_EMSCRIPTEN " Emscripten " .
*/
GLConfiguration & setFlags ( Flags flags ) {
_flags = flags ;
return * this ;
}
/**
* @ brief Context version
*
* @ note Not available in @ ref CORRADE_TARGET_EMSCRIPTEN " Emscripten " .
*/
GL : : Version version ( ) const { return _version ; }
# endif
/**
* @ brief Set context version
*
* If requesting version greater or equal to OpenGL 3.1 , core profile
* is used . The created context will then have any version which is
* backwards - compatible with requested one . Default is
* @ ref GL : : Version : : None , i . e . any provided version is used .
* @ note In @ ref CORRADE_TARGET_EMSCRIPTEN " Emscripten " this function
* does nothing ( @ ref GL : : Version : : GLES200 or
* @ ref GL : : Version : : GLES300 is used implicitly based on the
* target ) .
*/
GLConfiguration & setVersion ( GL : : Version version ) {
# ifndef CORRADE_TARGET_EMSCRIPTEN
_version = version ;
# else
static_cast < void > ( version ) ;
# endif
return * this ;
}
/** @brief Sample count */
Int sampleCount ( ) const { return _sampleCount ; }
/**
* @ brief Set sample count
* @ return Reference to self ( for method chaining )
*
* Default is @ cpp 0 @ ce , thus no multisampling . See also
* @ ref GL : : Renderer : : Feature : : Multisampling .
*/
GLConfiguration & setSampleCount ( Int count ) {
_sampleCount = count ;
return * this ;
}
# ifndef CORRADE_TARGET_EMSCRIPTEN
/**
* @ brief sRGB - capable default framebuffer
*
* @ note Not available in @ ref CORRADE_TARGET_EMSCRIPTEN " Emscripten " .
*/
bool isSRGBCapable ( ) const { return _sRGBCapable ; }
/**
* @ brief Set sRGB - capable default framebuffer
* @ return Reference to self ( for method chaining )
*
* Default is @ cpp false @ ce . See also
* @ ref GL : : Renderer : : Feature : : FramebufferSRGB .
* @ note Not available in @ ref CORRADE_TARGET_EMSCRIPTEN " Emscripten " .
*/
GLConfiguration & setSRGBCapable ( bool enabled ) {
_sRGBCapable = enabled ;
return * this ;
}
# endif
private :
Int _sampleCount ;
# ifndef CORRADE_TARGET_EMSCRIPTEN
GL : : Version _version ;
Flags _flags ;
bool _sRGBCapable ;
# endif
} ;
/**
@ brief Configuration
@ see @ ref Sdl2Application ( ) , @ ref GLConfiguration , @ ref create ( ) ,
@ ref tryCreate ( )
*/
class Sdl2Application : : Configuration {
public :
# if defined(MAGNUM_BUILD_DEPRECATED) && !defined(CORRADE_TARGET_EMSCRIPTEN)
/** @brief @copybrief GLConfiguration::Flag
* @ deprecated Use @ ref GLConfiguration : : Flag instead .
*/
typedef GLConfiguration : : Flag Flag ;
/** @brief @copybrief GLConfiguration::Flags
* @ deprecated Use @ ref GLConfiguration : : Flags instead .
*/
typedef GLConfiguration : : Flags Flags ;
# endif
/**
/**
* @ brief Window flag
* @ brief Window flag
*
*
@ -924,47 +1099,31 @@ class Sdl2Application::Configuration {
return * this ;
return * this ;
}
}
# ifdef MAGNUM_BUILD_DEPRECATED
# ifndef CORRADE_TARGET_EMSCRIPTEN
# ifndef CORRADE_TARGET_EMSCRIPTEN
/**
/** @brief @copybrief GLConfiguration::flags()
* @ brief Context flags
* @ deprecated Use @ ref GLConfiguration : : flags ( ) instead .
*
* @ note Not available in @ ref CORRADE_TARGET_EMSCRIPTEN " Emscripten " .
*/
*/
Flags flags ( ) const { return _flags ; }
CORRADE_DEPRECATED ( " use GLConfiguration::flags() instead " ) GLConfiguration : : Flags flags ( ) const { return _flags ; }
/**
/** @brief @copybrief GLConfiguration::setFlags()
* @ brief Set context flags
* @ deprecated Use @ ref GLConfiguration : : setFlags ( ) instead .
* @ return Reference to self ( for method chaining )
*
* Default is no flag . See also @ ref GL : : Context : : flags ( ) .
* @ note Not available in @ ref CORRADE_TARGET_EMSCRIPTEN " Emscripten " .
*/
*/
Configuration & setFlags ( Flags flags ) {
CORRADE_DEPRECATED ( " use GLConfiguration::setFlags() instead " ) Configuration & setFlags ( GLConfiguration : : Flags flags ) {
_flags = flags ;
_flags = flags ;
return * this ;
return * this ;
}
}
/**
/** @brief @copybrief GLConfiguration::version()
* @ brief Context version
* @ deprecated Use @ ref GLConfiguration : : version ( ) instead .
*
* @ note Not available in @ ref CORRADE_TARGET_EMSCRIPTEN " Emscripten " .
*/
*/
GL : : Version version ( ) const { return _version ; }
CORRADE_DEPRECATED ( " use GLConfiguration::version() instead " ) GL : : Version version ( ) const { return _version ; }
# endif
# endif
/**
/** @brief @copybrief GLConfiguration::setVersion()
* @ brief Set context version
* @ deprecated Use @ ref GLConfiguration : : setVersion ( ) instead .
*
* If requesting version greater or equal to OpenGL 3.1 , core profile
* is used . The created context will then have any version which is
* backwards - compatible with requested one . Default is
* @ ref GL : : Version : : None , i . e . any provided version is used .
* @ note In @ ref CORRADE_TARGET_EMSCRIPTEN " Emscripten " this function
* does nothing ( @ ref GL : : Version : : GLES200 or
* @ ref GL : : Version : : GLES300 is used implicitly based on the
* target ) .
*/
*/
Configuration & setVersion ( GL : : Version version ) {
CORRADE_DEPRECATED ( " use GLConfiguration::setVersion() instead " ) Configuration & setVersion ( GL : : Version version ) {
# ifndef CORRADE_TARGET_EMSCRIPTEN
# ifndef CORRADE_TARGET_EMSCRIPTEN
_version = version ;
_version = version ;
# else
# else
@ -973,42 +1132,34 @@ class Sdl2Application::Configuration {
return * this ;
return * this ;
}
}
/** @brief Sample count */
/** @brief @copybrief GLConfiguration::sampleCount()
Int sampleCount ( ) const { return _sampleCount ; }
* @ deprecated Use @ ref GLConfiguration : : sampleCount ( ) instead .
*/
CORRADE_DEPRECATED ( " use GLConfiguration::sampleCount() instead " ) Int sampleCount ( ) const { return _sampleCount ; }
/**
/** @brief @copybrief GLConfiguration::setSampleCount()
* @ brief Set sample count
* @ deprecated Use @ ref GLConfiguration : : setSampleCount ( ) instead .
* @ return Reference to self ( for method chaining )
*
* Default is @ cpp 0 @ ce , thus no multisampling . See also
* @ ref GL : : Renderer : : Feature : : Multisampling .
*/
*/
Configuration & setSampleCount ( Int count ) {
CORRADE_DEPRECATED ( " use GLConfiguration::setSampleCount() instead " ) Configuration & setSampleCount ( Int count ) {
_sampleCount = count ;
_sampleCount = count ;
return * this ;
return * this ;
}
}
# ifndef CORRADE_TARGET_EMSCRIPTEN
# ifndef CORRADE_TARGET_EMSCRIPTEN
/**
/** @brief @copybrief GLConfiguration::isSRGBCapable()
* @ brief sRGB - capable default framebuffer
* @ deprecated Use @ ref GLConfiguration : : isSRGBCapable ( ) instead .
*
* @ note Not available in @ ref CORRADE_TARGET_EMSCRIPTEN " Emscripten " .
*/
*/
bool isSRGBCapable ( ) const { return _sRGBCapable ; }
CORRADE_DEPRECATED ( " use GLConfiguration::isSRGBCapable() instead " ) bool isSRGBCapable ( ) const { return _sRGBCapable ; }
/**
/** @brief @copybrief GLConfiguration::setSRGBCapable()
* @ brief Set sRGB - capable default framebuffer
* @ deprecated Use @ ref GLConfiguration : : setSRGBCapable ( ) instead .
* @ return Reference to self ( for method chaining )
*
* Default is @ cpp false @ ce . See also
* @ ref GL : : Renderer : : Feature : : FramebufferSRGB .
* @ note Not available in @ ref CORRADE_TARGET_EMSCRIPTEN " Emscripten " .
*/
*/
Configuration & setSRGBCapable ( bool enabled ) {
CORRADE_DEPRECATED ( " use GLConfiguration::setSRGBCapable() instead " ) Configuration & setSRGBCapable ( bool enabled ) {
_sRGBCapable = enabled ;
_sRGBCapable = enabled ;
return * this ;
return * this ;
}
}
# endif
# endif
# endif
private :
private :
# if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_IOS)
# if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_IOS)
@ -1016,12 +1167,14 @@ class Sdl2Application::Configuration {
# endif
# endif
Vector2i _size ;
Vector2i _size ;
WindowFlags _windowFlags ;
WindowFlags _windowFlags ;
# ifdef MAGNUM_BUILD_DEPRECATED
Int _sampleCount ;
Int _sampleCount ;
# ifndef CORRADE_TARGET_EMSCRIPTEN
# ifndef CORRADE_TARGET_EMSCRIPTEN
GL : : Version _version ;
GL : : Version _version ;
Flags _flags ;
Flags _flags ;
bool _sRGBCapable ;
bool _sRGBCapable ;
# endif
# endif
# endif
} ;
} ;
/**
/**
@ -1719,7 +1872,7 @@ typedef BasicScreenedApplication<Sdl2Application> ScreenedApplication;
CORRADE_ENUMSET_OPERATORS ( Sdl2Application : : Flags )
CORRADE_ENUMSET_OPERATORS ( Sdl2Application : : Flags )
# ifndef CORRADE_TARGET_EMSCRIPTEN
# ifndef CORRADE_TARGET_EMSCRIPTEN
CORRADE_ENUMSET_OPERATORS ( Sdl2Application : : Configuration : : Flags )
CORRADE_ENUMSET_OPERATORS ( Sdl2Application : : GL Configuration: : Flags )
# endif
# endif
CORRADE_ENUMSET_OPERATORS ( Sdl2Application : : Configuration : : WindowFlags )
CORRADE_ENUMSET_OPERATORS ( Sdl2Application : : Configuration : : WindowFlags )
CORRADE_ENUMSET_OPERATORS ( Sdl2Application : : InputEvent : : Modifiers )
CORRADE_ENUMSET_OPERATORS ( Sdl2Application : : InputEvent : : Modifiers )