mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2025-01-06 08:53:36 +01:00
9eb723ee53
This macro used to protect the declaration of the [vram] variable of gint. This variable was short to keep drawing functions short but could clutter the namespace. That being said, it's even better to just [#define vram gint_vram] if you need. This change renames the variable to [gint_vram], exposes it whenever <gint/display.h> is included, and removes the GINT_NEED_VRAM macro altogether.
25 lines
444 B
C
25 lines
444 B
C
#include <gint/display.h>
|
|
#include <gint/defs/types.h>
|
|
|
|
/* dpixel() - change a pixel's color */
|
|
void dpixel(int x, int y, color_t color)
|
|
{
|
|
/* Sanity checks */
|
|
if((uint)x >= 128 || (uint)y >= 64) return;
|
|
|
|
uint32_t *lword = gint_vram + (y << 2) + (x >> 5);
|
|
uint32_t mask = 1 << (~x & 31);
|
|
|
|
if(color == C_WHITE)
|
|
{
|
|
*lword &= ~mask;
|
|
}
|
|
else if(color == C_BLACK)
|
|
{
|
|
*lword |= mask;
|
|
}
|
|
else if(color == C_INVERT)
|
|
{
|
|
*lword ^= mask;
|
|
}
|
|
}
|