some bugfixes

This commit is contained in:
j3d1 2018-11-06 16:06:05 +01:00
parent 6570f7fafc
commit c822a75df0
15 changed files with 93 additions and 94 deletions

View file

@ -17,7 +17,7 @@ public:
class fooValue : public value {
public:
fooValue(const char* str, int val) : value(str, val, 64, 96) {
fooValue(const char* str, int val) : value(str, val, 32, 48) {
}
void render(canvas &c);

View file

@ -1,15 +0,0 @@
//
// Created by jedi on 11/2/18.
//
#ifndef MGL_DMXMENU_BUFFER_8_H
#define MGL_DMXMENU_BUFFER_8_H
#include <stdlib.h>
#include <stdint.h>
#endif //MGL_DMXMENU_BUFFER_8_H

View file

@ -9,7 +9,6 @@
#include "gfx/font.h"
#include "fonts/basic_5x4.h"
#include "gfx/buffer.h"
#include "gfx/buffer_32.h"
class screen;

View file

@ -21,8 +21,9 @@ class layout {
private:
const int maxwidth_;
const int maxheight_;
int allocated_;
screen screen_;
screen& screen_;
int allocate_(node *, int);
@ -35,7 +36,7 @@ public:
static const int maxslots = 10;
Slot slots[maxslots];
layout(int width) : maxwidth_(width), screen_(width, 32) {
layout(screen& s) : maxwidth_(s.getWidth()), maxheight_(s.getHeight()), screen_(s) {
}

View file

@ -14,28 +14,19 @@ private:
const int height_;
public:
screen(int w, int h) : width_(w), height_(h) {
screen(int w, int h);
}
void draw(int x, int y);
void draw(int x, int y) {
hal_draw(x, y);
}
void draw(int x, int y, canvas &c);
void draw(int x, int y, canvas &c) {
for (int x_ = 0; x_ < 128; x_++)
for (int y_ = 0; y_ < 32; y_++)
if (c.buffer_.get(x_ * 32 + y_))
hal_draw(x + x_, y + y_);
}
void print(int x, int y, const char *str, font & = basic_5x4);
void print(int x, int y, const char *str, font & = basic_5x4){
void print(int x, int y, char *str, font & = basic_5x4);
}
int getWidth();
void print(int x, int y, char *str, font & = basic_5x4){
}
int getHeight();
};

View file

@ -10,11 +10,10 @@
void debug(const char* str);
void hal_init();
void hal_init_screen(int w, int h);
void hal_draw(int x, int y);
void hal_print(int x, int y, const char* str);
void hal_render();
void render();
void quit();
extern bool input[4];
@ -25,7 +24,4 @@ void operator delete(void * ptr);
#endif
extern const int SCREEN_WIDTH;
extern const int SCREEN_HEIGHT;
#endif

View file

@ -9,9 +9,10 @@
class node {
private:
node *parent_ = 0;
node *child_ = 0;
node *next_ = 0;
node *parent_ = nullptr;
node *child_ = nullptr;
node *cursor_ = nullptr;
node *next_ = nullptr;
void addNodes(bool b) {
}
@ -41,6 +42,7 @@ public:
template<typename ... Args>
node(const char *t, node *n, Args ... ns) : title_(t), minsize(24), maxsize(48) {
child_ = n;
cursor_ = n;
n->parent_ = this;
child_->addNodes(true, ns...);
}
@ -48,6 +50,14 @@ public:
node *getChild() {
return child_;
}
node *getNext() {
return next_;
}
node *getCursor() {
return cursor_;
}
};