configure bitmaps and correct makefile
This commit is contained in:
parent
8dd69caa7d
commit
bcbab0342a
10
Makefile
10
Makefile
|
@ -4,7 +4,7 @@
|
|||
target ?= sh3eb-elf
|
||||
|
||||
cflags := -m3 -mb -D FX9860G -ffreestanding -nostdlib -fstrict-volatile-bitfields -Wall \
|
||||
-Wextra -Os -I .
|
||||
-Wextra -Os -Iinclude -I .
|
||||
|
||||
lib := libfxengine.a
|
||||
header := include/
|
||||
|
@ -31,15 +31,19 @@ build/%.c.o: %.c
|
|||
@ mkdir -p $(dir $@)
|
||||
$(target)-gcc -c $< -o $@ $(cflags)
|
||||
|
||||
clear:
|
||||
clean:
|
||||
@ rm -rf build
|
||||
@ rm -f $(lib)
|
||||
|
||||
%/:
|
||||
mkdir -p $@
|
||||
|
||||
reinstall:
|
||||
@ make clean
|
||||
@ make
|
||||
@ make install
|
||||
|
||||
install:
|
||||
sh3eb-elf-ar -t $(lib)
|
||||
cp $(lib) $(prefix)
|
||||
cp -r $(header) $(prefix)include/fxengine
|
||||
cp -r $(header) $(prefix)/include/fxengine
|
||||
|
|
Binary file not shown.
|
@ -5,46 +5,47 @@
|
|||
0 dans layout -> transparent
|
||||
1 dans layout -> 1 dans color -> noir
|
||||
0 dans color -> blanc */
|
||||
|
||||
struct bitmap_rich_8
|
||||
/** bitmap rich type
|
||||
* @warning Monochrome only !
|
||||
* transparency is in the layout
|
||||
*/
|
||||
struct bitmap_rich
|
||||
{
|
||||
uint32_t size_px_x; // largeur en pixels
|
||||
uint32_t size_px_y; // hauteur en pixels
|
||||
uint32_t size_o_y; // taille en octets d'une rangée
|
||||
uint32_t size_px_x;
|
||||
uint32_t size_px_y;
|
||||
uint32_t size_o_y;
|
||||
|
||||
uint8_t * color; // bitmap monochrome
|
||||
uint8_t * layout; // transparence
|
||||
uint32_t * color;
|
||||
uint32_t * layout;
|
||||
};
|
||||
typedef struct bitmap_rich_16 bitmap_rich_16;
|
||||
typedef struct bitmap_rich bitmap_rich;
|
||||
|
||||
struct bitmap_rich_16
|
||||
{
|
||||
uint32_t size_px_x;
|
||||
uint32_t size_px_y;
|
||||
uint32_t size_o_y;
|
||||
/** get the color of pixel from rich bitmap
|
||||
* @return the color coded in a unsigned char :
|
||||
* if (color >> 1)
|
||||
* switch (color%2)
|
||||
* {
|
||||
* case 0:
|
||||
* // WHITE
|
||||
* break;
|
||||
* case 1:
|
||||
* // BLACK
|
||||
* }
|
||||
* else
|
||||
* // TRANSPARENT
|
||||
* @param the bitmap
|
||||
* @param x coordinate
|
||||
* @param y coordinate
|
||||
*/
|
||||
inline uint8_t bitmap_get_pixel_r(const bitmap_rich * bmp, uint32_t x, uint32_t y);
|
||||
|
||||
uint16_t * color;
|
||||
uint16_t * layout;
|
||||
};
|
||||
typedef struct bitmap_rich_16 bitmap_rich_16;
|
||||
|
||||
struct bitmap_rich_32
|
||||
{
|
||||
uint32_t size_px_x;
|
||||
uint32_t size_px_y;
|
||||
uint32_t size_o_y;
|
||||
|
||||
uint32_t * color;
|
||||
uint32_t * layout;
|
||||
};
|
||||
typedef struct bitmap_rich_32 bitmap_rich_32;
|
||||
/** display a pixel from rich bitmap
|
||||
* // TRANSPARENT
|
||||
* @param the bitmap
|
||||
* @param x coordinate
|
||||
* @param y coordinate
|
||||
*/
|
||||
void bitmap_display_pixel_r(const bitmap_rich * bmp, uint32_t bmp_x, uint32_t bmp_y, uint32_t x, uint32_t y);
|
||||
|
||||
|
||||
/* bitmap_get_color_<type>(int x, int y)
|
||||
returns a color coded in 2 bytes
|
||||
byte 7 -> layout (visible, invisible)
|
||||
byte 6 -> color (N || B) */
|
||||
|
||||
inline uint8_t bitmap_get_color_8(const bitmap_rich_8 * bmp,uint32_t x, uint32_t y);
|
||||
inline uint8_t bitmap_get_color_16(const bitmap_rich_16 * bmp,uint32_t x, uint32_t y);
|
||||
inline uint8_t bitmap_get_color_32(const bitmap_rich_32 * bmp,uint32_t x, uint32_t y);
|
BIN
libfxengine.a
BIN
libfxengine.a
Binary file not shown.
|
@ -1,28 +1,22 @@
|
|||
#include <bitmap.h>
|
||||
#include <gint/display.h>
|
||||
#include <render/bitmap.h>
|
||||
|
||||
inline uint8_t bitmap_get_color_8(const bitmap_rich_8 * bmp, uint32_t x, uint32_t y)
|
||||
inline uint8_t bitmap_get_pixel_r(const bitmap_rich * bmp, uint32_t x, uint32_t y)
|
||||
{
|
||||
if (x >= bmp->size_px_x || y >= bmp->size_px_y)
|
||||
const uint32_t indice = y * bmp.size_o_y + x >> 3;
|
||||
const uint32_t numero_bit = 7 - x % 8;
|
||||
if (x >= bmp->size_px_x || y >= bmp->size_px_y)
|
||||
return 0;
|
||||
|
||||
return ( bmp.layout[indice] | 1 << numero_bit ) << 1 + ( bmp.color[indice] | 1 << numero_bit );
|
||||
const uint32_t indice = y * bmp->size_o_y + x >> 5;
|
||||
|
||||
const uint32_t numero_bit = 31 - x % 32;
|
||||
|
||||
return ( bmp->layout[indice] | 1 << numero_bit ) << 1 + ( bmp->color[indice] | 1 << numero_bit );
|
||||
}
|
||||
|
||||
inline uint8_t bitmap_get_color_16(const bitmap_rich_16 * bmp, uint32_t x, uint32_t y)
|
||||
{
|
||||
if (x >= bmp->size_px_x || y >= bmp->size_px_y)
|
||||
const uint32_t indice = y * bmp.size_o_y + x >> 4;
|
||||
const uint32_t numero_bit = 15 - x % 16;
|
||||
|
||||
return ( bmp.layout[indice] | 1 << numero_bit ) << 1 + ( bmp.color[indice] | 1 << numero_bit );
|
||||
void bitmap_display_pixel_r(const bitmap_rich * bmp, uint32_t bmp_x, uint32_t bmp_y, uint32_t x, uint32_t y)
|
||||
{
|
||||
uint8_t color = bitmap_get_pixel_r(bmp, bmp_x, bmp_y);
|
||||
if (color >> 1)
|
||||
dpixel(x, y, 3 * (color % 2));
|
||||
}
|
||||
|
||||
inline uint8_t bitmap_get_color_32(const bitmap_rich_32 * bmp, uint32_t x, uint32_t y)
|
||||
{
|
||||
if (x >= bmp->size_px_x || y >= bmp->size_px_y)
|
||||
const uint32_t indice = y * bmp.size_o_y + x >> 5;
|
||||
const uint32_t numero_bit = 31 - x % 32;
|
||||
|
||||
return ( bmp.layout[indice] | 1 << numero_bit ) << 1 + ( bmp.color[indice] | 1 << numero_bit );
|
||||
}
|
Loading…
Reference in New Issue