//Mike Maxim, Roland Flury
//Simple graphics functions using OpenGL/GLUT

#ifndef _l3_graphics_ffi
#define _l3_graphics_ffi

#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <GL/gl.h>
#include <GL/glut.h>

/**
 * Creates a new window with the left upper corner at (x,y). The 
 * size of the window is cx pixels on the horizontal line and cy pixels
 * on the vertical line. 
 **/
void create_window(int x, int y, int cx, int cy);

/**
 * Sets a pixel at position (x,y) in a previously created window to 
 * the color specified by r (red) , g (green), b (blue), each of which 
 * should be in the range 0 .. 255.
 */
void set_pixel(int x, int y, int r, int g, int b);

/**
 * Refreshes the image - might not work propperly
 */
void refresh();

/**
 * A simple way to refresh the image every val milliseconds. 
 */
void glut_start_update(int val);

/**
 * Stops to update the screen
 */
void glut_stop_update();

/**
 * Allows to retrieve informations about the last mouse-click event.
 * Set updown to 0 to retrieve the 'on-click-down' position, set it 
 * to 1 to retrieve the 'on-click-up' positoin.
 * Set xy to 0 to retrieve the x-position or 1 for the y-position.
 */
int getMouse(int updown, int xy);

/**
 * Returns which mouse-button was pressed. 
 * 0 = Please figure out yourself... 
 * 1 = 
 * 2 = 
 */
int getMouseButton();

#endif
