46 lines
1.1 KiB
C
46 lines
1.1 KiB
C
#ifndef FBLIB_H
|
|
#define FBLIB_H
|
|
|
|
#include <unistd.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <math.h>
|
|
|
|
#include "fbfont.h"
|
|
|
|
#define WIDTH 240
|
|
#define HEIGHT 320
|
|
|
|
struct s_color {
|
|
unsigned char r;
|
|
unsigned char g;
|
|
unsigned char b;
|
|
};
|
|
typedef struct s_color color;
|
|
|
|
struct s_screen {
|
|
char *buffer;
|
|
unsigned int width;
|
|
unsigned int height;
|
|
unsigned char bpp; // bits per pixel
|
|
unsigned char step; // byte-wise step per pixel
|
|
unsigned int line; // line length
|
|
unsigned int screensize;
|
|
};
|
|
typedef struct s_screen screen;
|
|
|
|
void put_pixel(screen fb, int x, int y, int r, int g, int b);
|
|
void clear_screen(screen fb);
|
|
|
|
void draw_line(screen fb, int x0, int y0, int x1, int y1, int r, int g, int b);
|
|
|
|
void draw_rect(screen fb, int x0, int y0, int w, int h, int r, int g, int b);
|
|
void fill_rect(screen fb, int x, int y, int w, int h, int r, int g, int b);
|
|
|
|
void draw_circle(screen fb, int x0, int y0, int radius, int r, int g, int b);
|
|
void fill_circle(screen fb, int x0, int y0, int radius, int r, int g, int b);
|
|
|
|
void render_string(screen fb, fbfont font, char *text, int x, int y, int r, int g, int b);
|
|
|
|
#endif
|