rayzor

annotate src/renderer.cc @ 14:a9a948809c6f

starting the renderer screen, plus misc stuff
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 13 Apr 2014 08:06:21 +0300
parents 70e332156d02
children be616b58df99
rev   line source
nuclear@14 1 #include <string.h>
nuclear@9 2 #include "renderer.h"
nuclear@14 3 #include "rayzor.h"
nuclear@14 4 #include "keyb.h"
nuclear@14 5 #include "scrman.h"
nuclear@14 6
nuclear@14 7 struct RendererImpl {
nuclear@14 8 bool in_progress;
nuclear@14 9 int cur_x, cur_y; // current pixel being rendered
nuclear@14 10 int cur_pix; // current pixel (linear)
nuclear@14 11 };
nuclear@9 12
nuclear@9 13 Renderer::Renderer()
nuclear@9 14 {
nuclear@9 15 set_name("renderer");
nuclear@9 16 }
nuclear@9 17
nuclear@14 18 bool Renderer::init()
nuclear@14 19 {
nuclear@14 20 rend = new RendererImpl;
nuclear@14 21 memset(rend, 0, sizeof *rend);
nuclear@14 22 return true;
nuclear@14 23 }
nuclear@14 24
nuclear@14 25 void Renderer::shutdown()
nuclear@14 26 {
nuclear@14 27 if(rend) {
nuclear@14 28 delete rend;
nuclear@14 29 rend = 0;
nuclear@14 30 }
nuclear@14 31 }
nuclear@14 32
nuclear@9 33 void Renderer::draw() const
nuclear@9 34 {
nuclear@14 35 memset(fb_pixels, 0, fb_width * fb_height * 4);
nuclear@9 36 }
nuclear@14 37
nuclear@14 38 void Renderer::handle_keyboard(int key, bool press)
nuclear@14 39 {
nuclear@14 40 switch(key) {
nuclear@14 41 case KB_ESC:
nuclear@14 42 deactivate_screen();
nuclear@14 43 break;
nuclear@14 44
nuclear@14 45 }
nuclear@14 46 }