[waffle] [PATCH 17/17] examples/gl_basic: Update to use waffle_window_create2()

Emil Velikov emil.l.velikov at gmail.com
Wed Jan 21 06:12:25 PST 2015


On 4 January 2015 at 22:03, Chad Versace <chad.versace at intel.com> wrote:
> Tested on GLX, X11/EGL, Wayland, and GBM.
>
> Signed-off-by: Chad Versace <chad.versace at intel.com>
> ---
>  examples/gl_basic.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/examples/gl_basic.c b/examples/gl_basic.c
> index 69418c8..6f57799 100644
> --- a/examples/gl_basic.c
> +++ b/examples/gl_basic.c
> @@ -34,7 +34,7 @@
>  ///        each buffer swap.
>
>  #define _POSIX_C_SOURCE 199309L // glibc feature macro for nanosleep.
> -#define WAFFLE_API_VERSION 0x0103
> +#define WAFFLE_API_VERSION 0x0106
>  #define WAFFLE_API_EXPERIMENTAL
>
>  #include <getopt.h>
> @@ -628,7 +628,13 @@ main(int argc, char **argv)
>      if (!ctx)
>          error_waffle();
>
> -    window = waffle_window_create(config, window_width, window_height);
> +    const intptr_t window_attrib_list[] = {
> +        WAFFLE_WINDOW_WIDTH,    window_width,
> +        WAFFLE_WINDOW_HEIGHT,   window_height,
> +        0,
> +    };
> +

Chad,

Please move the window_attrib_list declaration prior to the code,
otherwise MSVC throws a few messy warns/errors

error C2143: syntax error : missing ';' before 'const'
waffle\examples\gl_basic.c:631
error C2065: 'window_attrib_list' : undeclared identifier
waffle\examples\gl_basic.c:637
warning C4047: 'function' : 'const intptr_t *' differs in levels of
indirection from 'int' waffle\examples\gl_basic.c:637
warning C4024: 'waffle_window_create2' : different types for formal
and actual parameter 2 waffle\examples\gl_basic.c:637

In case you're wondering it seems that mixing declarations and code is
supported as long as "basic" variable types are used -
(i.e. not a struct or typedef). With intptr_t being a "typedef int
__w64" the compiler goes crazy :-(

Haven't seen an official statement on the topic so ^^ is my take on things.

-Emil


More information about the waffle mailing list