pmc/include/surface.h
author Emilio Largo <largo@largo.homelinux.org>
Thu, 16 Apr 2009 12:49:12 +0200
changeset 45 7197576fedcf
parent 42 83b8151b966d
child 46 4b9e1ac40246
permissions -rw-r--r--
pmc: namespace algebra for vector -> the namespace prevents clashes with std::vector -> std::vector and algebra::Vector with capital V. md5: a md5 replacement ncurses: keypad function added committer: Markus Bröker <mbroeker@largo.homelinux.org>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     1
/**
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     2
 * test/demos/pmc/include/surface.h
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     3
 * Copyright (C) 2008 Markus Broeker
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     4
 */
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     5
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     6
#ifndef SURFACE_H
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     7
#define SURFACE_H
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     8
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     9
#include <object.h>
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    10
#include <SDL/SDL.h>
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    11
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    12
class Surface:public Object {
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    13
  private:
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    14
    int width;
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    15
    int height;
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    16
    int depth;
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    17
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    18
    Uint32 color, red, black;
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    19
    SDL_Surface *screen;
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    20
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    21
  public:
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    22
    enum foregroundColor { BLACK, RED };
45
7197576fedcf pmc: namespace algebra for vector
Emilio Largo <largo@largo.homelinux.org>
parents: 42
diff changeset
    23
      Surface (int w, int h, int d);
7197576fedcf pmc: namespace algebra for vector
Emilio Largo <largo@largo.homelinux.org>
parents: 42
diff changeset
    24
     ~Surface ();
42
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    25
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    26
    int getWidth () {
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    27
        return width;
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    28
    };
45
7197576fedcf pmc: namespace algebra for vector
Emilio Largo <largo@largo.homelinux.org>
parents: 42
diff changeset
    29
42
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    30
    int getHeight () {
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    31
        return height;
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    32
    };
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    33
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    34
    void drawPixel (int x, int y);
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    35
    void drawLine (int x1, int y1, int x2, int y2);
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    36
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    37
    void flip ();
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    38
    void setColor (enum foregroundColor);
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    39
};
83b8151b966d Klassenhierarchie erneuert, Codebase erneuert
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    40
#endif