jseb | 17 Jan 2011 22:41

Using Agar inside Freeglut

Hello,

I'm trying to integrate Agar widgets into Freeglut main loop.
I thought it should be possible to draw only Agar's widget, without 
initialising its own render driver.
But if i try and skip the Agar's driver registration, i cannot use widgets.

So, when running my sample code, i got two windows, instead of Agar's 
widget drawn in Freeglut window.

Below, you'll find my try.
I tried to make it as short as possible.
To compile:
  gcc test_freeglut.c $(agar-config --cflags --libs) -Wall -lglut

Thank you for having a look.

/* based on hello.c
    && http://wiki.libagar.org/wiki/Custom_event_loop
  */

#include <GL/gl.h>
#include <GL/freeglut.h>

#include <agar/core.h>
#include <agar/gui.h>

#define ERROR(str) fprintf(stderr,"Error %s at %d\n",str,__LINE__);

int is_esc_pressed = 0;
(Continue reading)

Olivier Boudeville | 17 Jan 2011 23:32
Picon

Struct declarations

Hi,

Most if not all structures are defined in Agar's code this way:

"""
typedef struct ag_font {
     [...]
} AG_Font;
"""

It prevents to forward-declare AG_Font, whereas:

"""
typedef struct  AG_Font {
     [...]
} AG_Font;
"""

would be, AFAIK, as good, and would allow in a third-party header file 
something like:

"""
struct AG_Font ;

[...]

typedef ::Agar_Font LowLevelFont ;
"""

thus removing the need to include Agar's headers in that user header.
(Continue reading)


Gmane