cool-bun-demo/bun.h

60 lines
1.5 KiB
C

#ifndef __BUN_H__
#define __BUN_H__
#include "screen.h"
#define COOL_BUN_WIDTH (32)
#define COOL_BUN_WIDTH_BYTES (COOL_BUN_WIDTH / 8)
#define COOL_BUN_HEIGHT (32)
#define COOL_BUN_PLANES (2)
#define COOL_BUN_LAST_ROW (COOL_BUN_HEIGHT - 1)
#define COOL_BUN_LAST_ROW_BYTES (COOL_BUN_LAST_ROW * COOL_BUN_WIDTH_BYTES)
#define COOL_BUN_PLANE_SIZE (COOL_BUN_WIDTH_BYTES * COOL_BUN_HEIGHT)
#define COOL_BUN_MEMORY_SIZE (COOL_BUN_PLANE_SIZE * COOL_BUN_PLANES)
#define BUN_MAX_RANGE (31 + 320)
#define BUN_COUNT (12)
#define BUN_SPEED (1)
#define BUN_HORIZ_DISTANCE_BETWEEN_BUNS ((BUN_MAX_RANGE / 4) - COOL_BUN_WIDTH)
#define BUN_TOTAL_HORIZ_DISTANCE (BUN_HORIZ_DISTANCE_BETWEEN_BUNS + COOL_BUN_WIDTH)
#define BUN_ROW_START (30)
#define BUN_VERT_DISTANCE_BETWEEN_BUNS (20)
#define BUN_TOTAL_VERT_DISTANCE (COOL_BUN_HEIGHT + BUN_VERT_DISTANCE_BETWEEN_BUNS)
#define FRAME_MAX (BUN_TOTAL_HORIZ_DISTANCE / BUN_SPEED)
#define FRAMES_FOR_SCREEN (90)
#define BUN_WAVE_LENGTH (FRAMES_FOR_SCREEN / 2)
struct BunRenderer {
struct ScreenSetup *screenSetup;
struct CurrentScreen *currentScreen;
};
void setupBunRenderer(
struct BunRenderer *,
struct ScreenSetup *,
struct CurrentScreen *
);
void renderBunFrame(
int frame,
struct BunRenderer *
);
void renderBun(
int x,
int y,
struct ScreenSetup *screenSetup,
struct CurrentScreen *currentScreen
);
void calculateBunPositions(
uint16_t frame,
short int bunPositions[BUN_COUNT][2],
struct ScreenSetup *screenSetup
);
#endif