comparison engine/core/video/sdl/renderbackendsdl.cpp @ 430:ad1f09d954f9

Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Tue, 23 Feb 2010 19:25:59 +0000
parents ad7969d9460b
children b2feacaed53c
comparison
equal deleted inserted replaced
429:be291458d9b5 430:ad1f09d954f9
49 49
50 const std::string& RenderBackendSDL::getName() const { 50 const std::string& RenderBackendSDL::getName() const {
51 static std::string backend_name = "SDL"; 51 static std::string backend_name = "SDL";
52 return backend_name; 52 return backend_name;
53 } 53 }
54 54
55 void RenderBackendSDL::init() { 55 void RenderBackendSDL::init() {
56 if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) 56 if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
57 throw SDLException(SDL_GetError()); 57 throw SDLException(SDL_GetError());
58 58
59 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); // temporary hack 59 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); // temporary hack
122 SDL_FillRect(m_screen->getSurface(), 0, 0x00); 122 SDL_FillRect(m_screen->getSurface(), 0, 0x00);
123 } 123 }
124 124
125 void RenderBackendSDL::endFrame() { 125 void RenderBackendSDL::endFrame() {
126 SDL_Flip(m_screen->getSurface()); 126 SDL_Flip(m_screen->getSurface());
127 } 127 }
128 128
129 Image* RenderBackendSDL::createImage(SDL_Surface* surface) { 129 Image* RenderBackendSDL::createImage(SDL_Surface* surface) {
130 return new SDLImage(surface); 130 return new SDLImage(surface);
131 } 131 }
132 132
133 Image* RenderBackendSDL::createImage(const uint8_t* data, unsigned int width, unsigned int height) { 133 Image* RenderBackendSDL::createImage(const uint8_t* data, unsigned int width, unsigned int height) {
134 return new SDLImage(data, width, height); 134 return new SDLImage(data, width, height);
135 } 135 }
136 136
137 bool RenderBackendSDL::putPixel(int x, int y, int r, int g, int b) { 137 bool RenderBackendSDL::putPixel(int x, int y, int r, int g, int b) {
138 return static_cast<SDLImage*>(m_screen)->putPixel(x, y, r, g, b); 138 return static_cast<SDLImage*>(m_screen)->putPixel(x, y, r, g, b);
139 } 139 }
140 140
141 void RenderBackendSDL::drawLine(const Point& p1, const Point& p2, int r, int g, int b) { 141 void RenderBackendSDL::drawLine(const Point& p1, const Point& p2, int r, int g, int b) {
142 static_cast<SDLImage*>(m_screen)->drawLine(p1, p2, r, g, b); 142 static_cast<SDLImage*>(m_screen)->drawLine(p1, p2, r, g, b);
143 } 143 }
144 144
145 void RenderBackendSDL::drawQuad(const Point& p1, const Point& p2, const Point& p3, const Point& p4, int r, int g, int b) { 145 void RenderBackendSDL::drawQuad(const Point& p1, const Point& p2, const Point& p3, const Point& p4, int r, int g, int b) {
146 static_cast<SDLImage*>(m_screen)->drawQuad(p1, p2, p3, p4, r, g, b); 146 static_cast<SDLImage*>(m_screen)->drawQuad(p1, p2, p3, p4, r, g, b);
147 } 147 }
148 } 148
149 void RenderBackendSDL::drawVertex(const Point& p, const uint8_t size, int r, int g, int b){
150 static_cast<SDLImage*>(m_screen)->drawVertex(p, 2, r, g, b);
151 }
152
153 }//FIFE