/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   graphique.h
 * Author: sd
 *
 * Created on 15 février 2019, 19:46
 */

#ifndef GRAPHIQUE_H
#define GRAPHIQUE_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>
#include <stdlib.h>
    
#include <SDL.h>
#include <SDL_surface.h>
#include <SDL_thread.h>
#include <SDL_events.h>

struct __graphique {
    SDL_Window* pWindow;
    SDL_Surface *screen;
    
    Uint8 fill_red; 
    Uint8 fill_green;
    Uint8 fill_blue;
    
    Uint32 fill_color;
    
} __graphique;

#define delay_ms SDL_Delay

int initWindow(const char* title, unsigned width, unsigned height);    

void backgroundWhite();
void background(Uint8 red, Uint8 green, Uint8 blue);

void exitWindow();

void rect(unsigned posx, unsigned posy, unsigned width, unsigned height);

void refreshWindow();

void fill(Uint8 red, Uint8 green, Uint8 blue);

void ligneVerticale(unsigned posx, unsigned posy, unsigned height);

void ligneHorizontale(unsigned posx, unsigned posy, unsigned width);

void _setPixel(unsigned x, unsigned y, Uint32 coul);

void _setPixelVerif(unsigned x, unsigned y, Uint32 coul);

void setPixel(unsigned posx, unsigned posy);

void cercle(unsigned posx, unsigned posy, unsigned rayon);

void disque(unsigned cx, unsigned cy, unsigned rayon);

void _echangerEntiers(unsigned* x, unsigned* y);

void ligne(unsigned x1, unsigned y1, unsigned x2, unsigned y2);

Uint32 _poolEvent(Uint32 interval, void *param);

#ifdef __cplusplus
}
#endif

#endif /* GRAPHIQUE_H */

