2016-12-27 19:12:41 +00:00
|
|
|
#ifndef PIXEL_H_INCLUDED
|
|
|
|
#define PIXEL_H_INCLUDED
|
|
|
|
|
|
|
|
#include <SDL2/SDL.h>
|
2016-12-28 22:26:58 +00:00
|
|
|
#include <CellElement.h>
|
2016-12-28 20:39:42 +00:00
|
|
|
#include <matrix.h>
|
2016-12-27 19:12:41 +00:00
|
|
|
|
|
|
|
typedef struct {
|
2016-12-28 20:39:42 +00:00
|
|
|
SDL_Window * window;
|
|
|
|
SDL_Renderer * renderer;
|
|
|
|
int WIDTH;
|
|
|
|
int HEIGHT;
|
|
|
|
SDL_Event event;
|
|
|
|
} SCREEN;
|
2016-12-27 19:12:41 +00:00
|
|
|
|
2016-12-28 20:39:42 +00:00
|
|
|
/**
|
|
|
|
* Set a pixel on a given screen
|
|
|
|
* @param screen the screen to display the pixel
|
|
|
|
* @param x x position
|
|
|
|
* @param y y position
|
|
|
|
* @param value display white if true and black if false
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
void SetPixel(SDL_Renderer *renderer, int x, int y, bool value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display an entire matrix on a given screen
|
|
|
|
* @param screen the screen where the matrix should be displayed
|
|
|
|
* @param m a Matrix
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
void DisplayMatrixSDL(SCREEN *screen, Matrix m);
|
2016-12-27 19:12:41 +00:00
|
|
|
|
2016-12-28 22:59:43 +00:00
|
|
|
/**
|
|
|
|
* Wait until the user press the enter key
|
|
|
|
* @param screen the screen where the renderer is
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
void WaitUntilEnter(SCREEN * screen);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print a matrix in a new SDL window
|
|
|
|
* @param Matrix the matrix to display
|
|
|
|
* @return int error code
|
|
|
|
*/
|
|
|
|
int NewWindowFromMatrix(Matrix m);
|
|
|
|
|
2016-12-27 19:12:41 +00:00
|
|
|
#endif
|