Banjo API 1.1.0-alpha
Low-level C99 game development API
Loading...
Searching...
No Matches
pixel_enumeration.c File Reference
#include <banjo/app.h>
#include <banjo/bitmap.h>
#include <banjo/draw.h>
#include <banjo/event.h>
#include <banjo/main.h>
#include <banjo/math.h>
#include <banjo/system.h>
#include <banjo/window.h>
Include dependency graph for pixel_enumeration.c:

Go to the source code of this file.

Data Structures

struct  grid_paint

Macros

#define CELLS   15
#define CELL_PX   20
#define GRID_PX   (CELLS * CELL_PX)
#define LEFT_X   20
#define RIGHT_X   (LEFT_X + GRID_PX + 40)
#define GRID_Y   40

Functions

static void fill_cell (struct grid_paint *g, int cx, int cy)
static bj_bool paint_pixel (void *user_data, int x, int y)
static bj_bool paint_cell (void *user_data, int x, int y, bj_real t)
static void draw_grid_lines (struct bj_bitmap *bmp, int origin_x, uint32_t color)
static void draw (struct bj_bitmap *bmp)
static void on_draw (struct bj_window *w, struct bj_render_target *target, const struct bj_rect *dirty, void *user_data)
static void * setup (struct bj_app *app, void *init_data)
static void step (struct bj_app *app, struct bj_tick_info tick, void *user_data)
static void teardown (struct bj_app *app, void *user_data)
int main (int argc, char *argv[])

Variables

static struct bj_window * window = 0
static bj_real angle = BJ_FZERO

Data Structure Documentation

◆ grid_paint

struct grid_paint
Examples
pixel_enumeration.c.

Definition at line 40 of file pixel_enumeration.c.

Data Fields
struct bj_bitmap * bmp
uint32_t color
int origin_x

Macro Definition Documentation

◆ CELL_PX

#define CELL_PX   20
Examples
pixel_enumeration.c.

Definition at line 30 of file pixel_enumeration.c.

Referenced by draw(), draw_grid_lines(), and fill_cell().

◆ CELLS

#define CELLS   15
Examples
pixel_enumeration.c.

Definition at line 29 of file pixel_enumeration.c.

Referenced by draw_grid_lines(), and fill_cell().

◆ GRID_PX

#define GRID_PX   (CELLS * CELL_PX)
Examples
pixel_enumeration.c.

Definition at line 31 of file pixel_enumeration.c.

Referenced by draw_grid_lines(), and setup().

◆ GRID_Y

#define GRID_Y   40
Examples
pixel_enumeration.c.

Definition at line 34 of file pixel_enumeration.c.

Referenced by draw(), draw_grid_lines(), fill_cell(), and setup().

◆ LEFT_X

#define LEFT_X   20
Examples
pixel_enumeration.c.

Definition at line 32 of file pixel_enumeration.c.

Referenced by draw().

◆ RIGHT_X

#define RIGHT_X   (LEFT_X + GRID_PX + 40)
Examples
pixel_enumeration.c.

Definition at line 33 of file pixel_enumeration.c.

Referenced by draw(), and setup().

Function Documentation

◆ draw()

void draw ( struct bj_bitmap * bmp)
static

Definition at line 81 of file pixel_enumeration.c.

◆ draw_grid_lines()

void draw_grid_lines ( struct bj_bitmap * bmp,
int origin_x,
uint32_t color )
static
Examples
pixel_enumeration.c.

Definition at line 72 of file pixel_enumeration.c.

Referenced by draw().

◆ fill_cell()

void fill_cell ( struct grid_paint * g,
int cx,
int cy )
static
Examples
pixel_enumeration.c.

Definition at line 46 of file pixel_enumeration.c.

Referenced by paint_cell(), and paint_pixel().

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 163 of file pixel_enumeration.c.

◆ on_draw()

void on_draw ( struct bj_window * w,
struct bj_render_target * target,
const struct bj_rect * dirty,
void * user_data )
static

Definition at line 114 of file pixel_enumeration.c.

◆ paint_cell()

bj_bool paint_cell ( void * user_data,
int x,
int y,
bj_real t )
static
Examples
pixel_enumeration.c.

Definition at line 66 of file pixel_enumeration.c.

Referenced by draw().

◆ paint_pixel()

bj_bool paint_pixel ( void * user_data,
int x,
int y )
static
Examples
pixel_enumeration.c.

Definition at line 60 of file pixel_enumeration.c.

Referenced by draw().

◆ setup()

void * setup ( struct bj_app * app,
void * init_data )
static

Definition at line 124 of file pixel_enumeration.c.

◆ step()

void step ( struct bj_app * app,
struct bj_tick_info tick,
void * user_data )
static

Definition at line 142 of file pixel_enumeration.c.

◆ teardown()

void teardown ( struct bj_app * app,
void * user_data )
static

Definition at line 157 of file pixel_enumeration.c.

Variable Documentation

◆ angle

bj_real angle = BJ_FZERO
static
Examples
physics_kinematics.c, and pixel_enumeration.c.

Definition at line 37 of file pixel_enumeration.c.

Referenced by draw(), reset_ball(), and step().

◆ window

struct bj_window* window = 0
static

Definition at line 36 of file pixel_enumeration.c.