mirror of
https://github.com/kiedtl/fire.git
synced 2024-11-16 04:56:38 +00:00
remove ccommon dependency
remove submodule
This commit is contained in:
parent
861d806379
commit
48f7ea3f3b
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,6 +1,3 @@
|
|||||||
[submodule "sub/termbox_next"]
|
[submodule "sub/termbox_next"]
|
||||||
path = sub/termbox_next
|
path = sub/termbox_next
|
||||||
url = https://github.com/cylgom/termbox_next
|
url = https://github.com/cylgom/termbox_next
|
||||||
[submodule "sub/ccommon"]
|
|
||||||
path = sub/ccommon
|
|
||||||
url = https://github.com/lptstr/ccommon
|
|
||||||
|
7
args.h
7
args.h
@ -13,12 +13,17 @@
|
|||||||
#define ARGS_INCLUDED
|
#define ARGS_INCLUDED
|
||||||
#include "bool.h"
|
#include "bool.h"
|
||||||
#include "args.h"
|
#include "args.h"
|
||||||
|
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
#include "sys/types.h"
|
||||||
|
#else
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
extern char *argv0;
|
extern char *argv0;
|
||||||
|
|
||||||
typedef struct Options {
|
typedef struct Options {
|
||||||
usize refresh_rate;
|
size_t refresh_rate;
|
||||||
bool truecolor;
|
bool truecolor;
|
||||||
} Options;
|
} Options;
|
||||||
|
|
||||||
|
7
colors.h
7
colors.h
@ -1,10 +1,15 @@
|
|||||||
#ifndef COLORS_INCLUDED
|
#ifndef COLORS_INCLUDED
|
||||||
#define COLORS_INCLUDED
|
#define COLORS_INCLUDED
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
#include "termbox.h"
|
#include "termbox.h"
|
||||||
#define CLRS_LEN 13
|
#define CLRS_LEN 13
|
||||||
|
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
#include "sys/types.h"
|
||||||
|
#else
|
||||||
|
#include "types.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define RED 0xdd1111
|
#define RED 0xdd1111
|
||||||
#define BLACK 0x000000
|
#define BLACK 0x000000
|
||||||
#define YELLOW 0xff7700
|
#define YELLOW 0xff7700
|
||||||
|
21
draw.c
21
draw.c
@ -4,11 +4,16 @@
|
|||||||
|
|
||||||
#include "args.h"
|
#include "args.h"
|
||||||
#include "termbox.h"
|
#include "termbox.h"
|
||||||
#include "types.h"
|
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "colors.h"
|
#include "colors.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
|
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
#include "sys/types.h"
|
||||||
|
#else
|
||||||
|
#include "types.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// arguments
|
// arguments
|
||||||
extern struct Options *opts;
|
extern struct Options *opts;
|
||||||
|
|
||||||
@ -20,8 +25,8 @@ init ( struct buffer *buf )
|
|||||||
buf->width = tb_width();
|
buf->width = tb_width();
|
||||||
buf->height = tb_height();
|
buf->height = tb_height();
|
||||||
|
|
||||||
usize len = buf->width * buf->height;
|
size_t len = buf->width * buf->height;
|
||||||
buf->buf = (u8*) malloc(len);
|
buf->buf = (uint8_t*) malloc(len);
|
||||||
len -= buf->width;
|
len -= buf->width;
|
||||||
|
|
||||||
if (buf->buf == NULL) {
|
if (buf->buf == NULL) {
|
||||||
@ -42,15 +47,15 @@ init ( struct buffer *buf )
|
|||||||
void
|
void
|
||||||
dofire ( struct buffer *buf )
|
dofire ( struct buffer *buf )
|
||||||
{
|
{
|
||||||
usize src;
|
size_t src;
|
||||||
usize random;
|
size_t random;
|
||||||
usize dest;
|
size_t dest;
|
||||||
|
|
||||||
struct tb_cell *realbuf = tb_cell_buffer();
|
struct tb_cell *realbuf = tb_cell_buffer();
|
||||||
|
|
||||||
for (usize x = 0; x < buf->width; ++x)
|
for (size_t x = 0; x < buf->width; ++x)
|
||||||
{
|
{
|
||||||
for (usize y = 1; y < buf->height; ++y)
|
for (size_t y = 1; y < buf->height; ++y)
|
||||||
{
|
{
|
||||||
src = y * buf->width + x;
|
src = y * buf->width + x;
|
||||||
random = (rand() % 7) & 3;
|
random = (rand() % 7) & 3;
|
||||||
|
10
draw.h
10
draw.h
@ -1,14 +1,18 @@
|
|||||||
#ifndef DRAW_INCLUDED
|
#ifndef DRAW_INCLUDED
|
||||||
#define DRAW_INCLUDED
|
#define DRAW_INCLUDED
|
||||||
|
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
#include "sys/types.h"
|
||||||
|
#else
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct buffer
|
typedef struct buffer
|
||||||
{
|
{
|
||||||
usize width;
|
size_t width;
|
||||||
usize height;
|
size_t height;
|
||||||
|
|
||||||
u8* buf;
|
uint8_t* buf;
|
||||||
} buffer;
|
} buffer;
|
||||||
|
|
||||||
void init ( struct buffer *buf );
|
void init ( struct buffer *buf );
|
||||||
|
11
main.c
11
main.c
@ -3,10 +3,15 @@
|
|||||||
#include "bool.h"
|
#include "bool.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "types.h"
|
|
||||||
#include "termbox.h"
|
#include "termbox.h"
|
||||||
#include "args.h"
|
#include "args.h"
|
||||||
|
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
#include "sys/types.h"
|
||||||
|
#else
|
||||||
|
#include "types.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define VERSION "0.2.0"
|
#define VERSION "0.2.0"
|
||||||
|
|
||||||
// argument parsing (args.h)
|
// argument parsing (args.h)
|
||||||
@ -25,7 +30,7 @@ main ( int argc, char *argv[] )
|
|||||||
// default args
|
// default args
|
||||||
opts->refresh_rate = 5;
|
opts->refresh_rate = 5;
|
||||||
opts->truecolor = FALSE;
|
opts->truecolor = FALSE;
|
||||||
usize output_mode = TB_OUTPUT_NORMAL;
|
size_t output_mode = TB_OUTPUT_NORMAL;
|
||||||
|
|
||||||
// argument parsing
|
// argument parsing
|
||||||
argv0 = argv[0];
|
argv0 = argv[0];
|
||||||
@ -75,7 +80,7 @@ main ( int argc, char *argv[] )
|
|||||||
tb_present();
|
tb_present();
|
||||||
|
|
||||||
// event handling
|
// event handling
|
||||||
int err = (usize) tb_peek_event(&e, opts->refresh_rate);
|
int err = (size_t) tb_peek_event(&e, opts->refresh_rate);
|
||||||
|
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
continue;
|
continue;
|
||||||
|
2
makefile
2
makefile
@ -8,7 +8,7 @@ NAME = fire
|
|||||||
WARNING = -Wall -Wextra -pedantic -Wmissing-prototypes \
|
WARNING = -Wall -Wextra -pedantic -Wmissing-prototypes \
|
||||||
-Wold-style-definition -Werror
|
-Wold-style-definition -Werror
|
||||||
|
|
||||||
INC = -Isub/termbox_next/src -Isub/ccommon/
|
INC = -Isub/termbox_next/src
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -std=c99 -O3 $(WARNING) $(INC)
|
CFLAGS = -std=c99 -O3 $(WARNING) $(INC)
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Subproject commit 4a52d5153f63b20691410debdaba619f7923e493
|
|
@ -1 +1 @@
|
|||||||
Subproject commit 2312da153e44face7bb45aa2798ec284289c17ca
|
Subproject commit 7b85905531bf9e5908c67276dac55d3241361f20
|
Loading…
Reference in New Issue
Block a user