add first code
This commit is contained in:
parent
f207af2c4a
commit
8bf49928e5
5 changed files with 181 additions and 1 deletions
29
src/col.cpp
Normal file
29
src/col.cpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
#include "hal.h"
|
||||
#include "col.h"
|
||||
|
||||
|
||||
void Node::p(int i){
|
||||
for(int j = 0; j < i; j++){ print("__"); }
|
||||
if(title_)
|
||||
print(title_);
|
||||
else
|
||||
print("--");
|
||||
|
||||
if(view.render)
|
||||
view.render(0,0,this);
|
||||
|
||||
print("\n");
|
||||
|
||||
if(child_)
|
||||
child_->p(i+1);
|
||||
|
||||
if(next_)
|
||||
next_->p(i);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void draw_menu(int offset, int size, Node* val){
|
||||
|
||||
}
|
||||
35
src/hal.cpp
Normal file
35
src/hal.cpp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
|
||||
#ifdef LINUX
|
||||
|
||||
#include <iostream>
|
||||
|
||||
void print(const char* str){
|
||||
std::cout << str << std::flush;
|
||||
}
|
||||
void print(int str){
|
||||
std::cout << str << std::flush;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
void * operator new(unsigned int size)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
void operator delete(void * ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void print(const char* str){
|
||||
|
||||
}
|
||||
|
||||
void print(int str){
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
41
src/main.cpp
41
src/main.cpp
|
|
@ -1,6 +1,45 @@
|
|||
|
||||
|
||||
#include "hal.h"
|
||||
#include "col.h"
|
||||
|
||||
void draw_foo(int offset, int size, Node* ptr){
|
||||
Value* val = (Value*) ptr;
|
||||
print("\t|");
|
||||
if(ptr)
|
||||
print(ptr->title_);
|
||||
//print(ptr->state);
|
||||
print("|");
|
||||
}
|
||||
|
||||
void draw_blub(int offset, int size, Node* val){
|
||||
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
return 0;
|
||||
Node root(nullptr,
|
||||
new Node("foo",
|
||||
new Node("foo",
|
||||
new Node("foo", new Value("FOO",5,draw_foo))
|
||||
),
|
||||
new Node("foo", new Value("FOO",5,draw_foo)),
|
||||
new Node("foo", new Value("FOO",5,draw_foo))
|
||||
),
|
||||
new Node("blub", new Value("BLUB",5,draw_blub)),
|
||||
new Node("blub", new Value("BLUB",5,draw_blub)),
|
||||
new Node("blub", new Value("BLUB",5,draw_blub))
|
||||
);
|
||||
|
||||
|
||||
root.p(0);
|
||||
|
||||
|
||||
// 128 x 32
|
||||
Layout l(64);
|
||||
|
||||
//build tree
|
||||
//walk tree + allocate slots
|
||||
//position slots
|
||||
//render
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue