add dynamic buffers

This commit is contained in:
j3d1 2018-11-05 10:53:59 +01:00
parent 3f3c40a9b1
commit d958452e48
14 changed files with 176 additions and 67 deletions

View file

@ -1,29 +1,23 @@
#include "hal.h"
#include "col.h"
#include "example.h"
#include "../inc/hal.h"
#include "gfx/canvas.h"
char peng[] = {'_','_','_','_','_',0};
int j = 0;
void draw_foo(int offset, int size, Node* ptr){
void draw_foo(int offset, int size, Node* ptr, canvas& c){
Value* val = (Value*) ptr;
/*debug("|");
if(ptr)
debug(ptr->title_);
//print(ptr->state);
debug("|");*/
for(int i = 0; i<32; i++)
hal_draw(offset,i);
for(int i = 0; i<size; i++)
hal_draw(offset+i,31-i%32);
for(int i = 0; i<size; i++)
hal_draw(offset+i,31-(i+16)%32);
hal_print(offset+5 , 10, ptr->title_);
for(int i = 0; i<32; i++)
c.draw(0,i);
for(int i = 0; i<size; i++)
c.draw(i,31-i%32);
for(int i = 0; i<size; i++)
c.draw(i,31-(i+16)%32);
c.print(5 , 10, ptr->title_);
peng[0]=input[0]?' ':'#';
peng[1]=input[1]?' ':'#';
peng[2]=input[2]?' ':'#';
@ -31,32 +25,21 @@ void draw_foo(int offset, int size, Node* ptr){
j++;
j%=26;
peng[4] = 'a'+j;
hal_print(offset+5 , 20, peng);
c.print(5 , 20, peng);
}
void draw_blub(int offset, int size, Node* ptr){
void draw_blub(int offset, int size, Node* ptr, canvas& c){
Value* val = (Value*) ptr;
/*debug("#");
if(ptr)
debug(ptr->title_);
//print(ptr->state);
debug("#");*/
for(int i = 0; i<32;i++)
hal_draw(offset,i);
c.draw(0,i);
hal_print(offset+5 , 10, ptr->title_);
c.print(5 , 10, ptr->title_);
}
void draw_menu(int offset, int size, Node* val){
/*if(val&&val->title_){
debug("_");
debug(val->title_);
debug("_");
//print(ptr->state);
}*/
void draw_menu(int offset, int size, Node* val, canvas& c){
for(int i = 0; i<32;i++)
hal_draw(offset,i);
c.draw(0,i);
for(int i = 0; i<32 && i<size;i++)
hal_draw(offset+(i%size),i);
c.draw((i%size),i);
}