Darwinian Smoke  1
Une simulation de fumées vivantes disposant de comportements variables et d'un transmission héréditaire de ceux-ci, qui sont soumis à la sélection naturelle dans un environnement hostile.
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Screen Class Reference

d'affiche des trucs à l'écran More...

#include <Screen.h>

Collaboration diagram for Screen:
Collaboration graph

Public Member Functions

 Screen ()
 Par défaut, taille 300px dans tous les sens. More...
 
 Screen (int x_min, int y_min, int x_max, int y_max)
 
 Screen (Case min, Case max)
 Construit un écran vide avec les bordures des cases min et max. More...
 
 Screen (const std::list< Case > &l)
 Construit un écran avec les bordures de la liste. More...
 
int w () const
 
int h () const
 
void show_case (const Case &c, float rad=1.0, Uint32 color=0x000000)
 
void show_case (const std::list< Case > &l, float rad=1.0, Uint32 color=0x000000)
 Afiche une liste de cases sur un Screen. More...
 
void disc (int x, int y, int radius, Uint32 color=0xFF0000)
 
void rect (int x, int y, int w, int h, Uint32 color=0xFF)
 
void line (int x0, int y0, int x1, int y1, Uint32 color=0xFF0000)
 
void axes (Uint32 color=0x000000)
 
bool flip ()
 
bool inside (int x, int y)
 Are the coordinates inside the screen ? More...
 
void set_bounds (int x_min, int y_min, int x_max, int y_max)
 Set screen bounds. More...
 
 ~Screen ()
 destructors More...
 

Protected Member Functions

void _disc (SDL_Surface *surf, int x_center, int y_center, int radius, Uint32 color)
 
void _rect (SDL_Surface *surf, int x_center, int y_center, int w, int h, Uint32 color)
 
void _line (SDL_Surface *surf, int x0, int y0, int x1, int y1, Uint32 color)
 
void _show_case (SDL_Surface *surf, const Case &c, float rad, Uint32 color)
 
void _put_pixel (SDL_Surface *surf, Uint32 color, int x, int y)
 
void _put_pixel (SDL_Surface *surf, int x, int y, Uint8 r, Uint8 g, Uint8 b)
 

Protected Attributes

SDL_Surface * _screen
 
int _w
 
int _h
 
int x_zero
 
int y_zero
 

Detailed Description

d'affiche des trucs à l'écran

Constructor & Destructor Documentation

Screen::Screen ( )
inline

Par défaut, taille 300px dans tous les sens.

Screen::Screen ( int  x_min,
int  y_min,
int  x_max,
int  y_max 
)
inline

Constructor of Screen open a SDL window

Parameters
x_minx_min of the window (e.g. -400)
y_miny_min of the window (e.g. -400)
x_maxx_max of the window (e.g. 400)
y_maxy_max of the window (e.g. 400)
Screen::Screen ( Case  min,
Case  max 
)
inline

Construit un écran vide avec les bordures des cases min et max.

Screen::Screen ( const std::list< Case > &  l)
inline

Construit un écran avec les bordures de la liste.

Screen::~Screen ( )
inline

destructors

Member Function Documentation

void Screen::_disc ( SDL_Surface *  surf,
int  x_center,
int  y_center,
int  radius,
Uint32  color 
)
protected
void Screen::_line ( SDL_Surface *  surf,
int  x0,
int  y0,
int  x1,
int  y1,
Uint32  color 
)
protected
void Screen::_put_pixel ( SDL_Surface *  surf,
Uint32  color,
int  x,
int  y 
)
inlineprotected
void Screen::_put_pixel ( SDL_Surface *  surf,
int  x,
int  y,
Uint8  r,
Uint8  g,
Uint8  b 
)
inlineprotected
void Screen::_rect ( SDL_Surface *  surf,
int  x_center,
int  y_center,
int  w,
int  h,
Uint32  color 
)
protected
void Screen::_show_case ( SDL_Surface *  surf,
const Case c,
float  rad,
Uint32  color 
)
protected
void Screen::axes ( Uint32  color = 0x000000)
inline

draw axes

Parameters
color0xRRGGBBAA (default: black)
void Screen::disc ( int  x,
int  y,
int  radius,
Uint32  color = 0xFF0000 
)
inline

draw a disc

Parameters
xx-coordinate of the center (in pixels)
yy-coordinate of the center (in pixels)
radius(in pixels)
color0xRRGGBBAA (default: red)
bool Screen::flip ( )
inline

Flip the screen: swap buffer1 and buffer2; in effect, update the screen to take the drawings into account.

Returns
faux si on a quitté
int Screen::h ( ) const
inline
Returns
the height of the screen
bool Screen::inside ( int  x,
int  y 
)
inline

Are the coordinates inside the screen ?

void Screen::line ( int  x0,
int  y0,
int  x1,
int  y1,
Uint32  color = 0xFF0000 
)
inline

draw a line

Parameters
x0starting x-coordinate (in pixels)
y0starting y-coordinate (in pixels)
x1ending x-coordinate (in pixels)
y1ending y-coordinate (in pixels)
color0xRRGGBBAA (default: red)
void Screen::rect ( int  x,
int  y,
int  w,
int  h,
Uint32  color = 0xFF 
)
inline

draw a filled rectangle

Parameters
xx-coordinate of the center (in pixels)
yy-coordinate of the center (in pixels)
wwidth of the rectangle (in pixels)
hheight of the rectangle (in pixels)
color0xRRGGBBAA (default: blue)
void Screen::set_bounds ( int  x_min,
int  y_min,
int  x_max,
int  y_max 
)

Set screen bounds.

void Screen::show_case ( const Case c,
float  rad = 1.0,
Uint32  color = 0x000000 
)
inline

Dessine une case avec ses coordonnées

Parameters
xx-coordinate of the center (in pixels)
yy-coordinate of the center (in pixels)
radPar quoi le rayon est multiplié
color0xRRGGBBAA (default: black)
void Screen::show_case ( const std::list< Case > &  l,
float  rad = 1.0,
Uint32  color = 0x000000 
)
inline

Afiche une liste de cases sur un Screen.

int Screen::w ( ) const
inline
Returns
the width of the screen

Member Data Documentation

int Screen::_h
protected
SDL_Surface* Screen::_screen
protected
int Screen::_w
protected
int Screen::x_zero
protected
int Screen::y_zero
protected

The documentation for this class was generated from the following files: