Compare commits
5 commits
Author | SHA1 | Date | |
---|---|---|---|
09cfe6cee9 | |||
471a8b42d2 | |||
89cdfb6f23 | |||
22a1fd4569 | |||
cb2376a82f |
15 changed files with 57 additions and 38 deletions
15
CHANGE.md
15
CHANGE.md
|
@ -1,3 +1,18 @@
|
||||||
|
0.6.2_7 (2022-12-19)
|
||||||
|
====================
|
||||||
|
|
||||||
|
* Update Makefile.
|
||||||
|
|
||||||
|
0.6.2_6 (2020-12-30)
|
||||||
|
====================
|
||||||
|
|
||||||
|
* Update CFLAGS.
|
||||||
|
|
||||||
|
0.6.2_5 (2020-12-30)
|
||||||
|
====================
|
||||||
|
|
||||||
|
* Rename binary.
|
||||||
|
|
||||||
0.6.2_4 (2020-12-25)
|
0.6.2_4 (2020-12-25)
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
|
26
src/Makefile
26
src/Makefile
|
@ -1,8 +1,10 @@
|
||||||
# Copyright (c) 2019-2020, yzrh <yzrh@noema.org>
|
#
|
||||||
|
# Copyright (c) 2019-2023, yzrh <yzrh@noema.org>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
src = main.c collision.c game.c input.c renderer.c
|
src = snake-sdl.c collision.c game.c input.c renderer.c
|
||||||
inc = extern.h game.h input.h renderer.h screen.h version.h
|
inc = extern.h game.h input.h renderer.h screen.h version.h
|
||||||
|
|
||||||
.ifdef GPIO
|
.ifdef GPIO
|
||||||
|
@ -16,8 +18,8 @@ obj = ${src:.c=.o}
|
||||||
|
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
|
|
||||||
CFLAGS = -O3 -march=native -pipe -flto=thin -Wall -Wno-unused-result
|
CFLAGS = -O2 -pipe -flto -Wall -Wextra -Wno-unused-parameter
|
||||||
LDFLAGS = -Wl,-O3 -lpthread -lSDL2 -lSDL2_ttf
|
LDFLAGS = -Wl,-O2 -lpthread -lSDL2 -lSDL2_ttf
|
||||||
|
|
||||||
.ifdef SOUND
|
.ifdef SOUND
|
||||||
|
|
||||||
|
@ -31,20 +33,20 @@ CFLAGS += -I/usr/local/include
|
||||||
LDFLAGS += -L/usr/local/lib
|
LDFLAGS += -L/usr/local/lib
|
||||||
|
|
||||||
all: ${obj} ${inc}
|
all: ${obj} ${inc}
|
||||||
${CC} ${LDFLAGS} -o snake ${obj}
|
${CC} ${LDFLAGS} -o snake-sdl ${obj}
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f snake ${obj}
|
rm -f snake-sdl ${obj}
|
||||||
|
|
||||||
install:
|
install:
|
||||||
install -d ${PREFIX}/bin
|
install -d ${PREFIX}/bin
|
||||||
install -d ${PREFIX}/share/snake
|
install -d ${PREFIX}/share/snake-sdl
|
||||||
install snake ${PREFIX}/bin
|
install snake-sdl ${PREFIX}/bin
|
||||||
install -m644 ../contrib/font.ttf ${PREFIX}/share/snake
|
install -m644 ../contrib/font.ttf ${PREFIX}/share/snake-sdl
|
||||||
install -m644 ../contrib/music.flac ${PREFIX}/share/snake
|
install -m644 ../contrib/music.flac ${PREFIX}/share/snake-sdl
|
||||||
|
|
||||||
deinstall:
|
deinstall:
|
||||||
rm -f ${PREFIX}/bin/snake
|
rm -f ${PREFIX}/bin/snake-sdl
|
||||||
rm -rf ${PREFIX}/share/snake
|
rm -rf ${PREFIX}/share/snake-sdl
|
||||||
|
|
||||||
.PHONY: all clean install deinstall
|
.PHONY: all clean install deinstall
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2020, yzrh <yzrh@noema.org>
|
* Copyright (c) 2019-2021, yzrh <yzrh@noema.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2020, yzrh <yzrh@noema.org>
|
* Copyright (c) 2019-2021, yzrh <yzrh@noema.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2020, yzrh <yzrh@noema.org>
|
* Copyright (c) 2019-2021, yzrh <yzrh@noema.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2020, yzrh <yzrh@noema.org>
|
* Copyright (c) 2019-2021, yzrh <yzrh@noema.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2020, yzrh <yzrh@noema.org>
|
* Copyright (c) 2019-2021, yzrh <yzrh@noema.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2020, yzrh <yzrh@noema.org>
|
* Copyright (c) 2019-2021, yzrh <yzrh@noema.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2020, yzrh <yzrh@noema.org>
|
* Copyright (c) 2019-2021, yzrh <yzrh@noema.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2020, yzrh <yzrh@noema.org>
|
* Copyright (c) 2019-2021, yzrh <yzrh@noema.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2020, yzrh <yzrh@noema.org>
|
* Copyright (c) 2019-2021, yzrh <yzrh@noema.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2020, yzrh <yzrh@noema.org>
|
* Copyright (c) 2019-2021, yzrh <yzrh@noema.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2020, yzrh <yzrh@noema.org>
|
* Copyright (c) 2019-2021, yzrh <yzrh@noema.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2020, yzrh <yzrh@noema.org>
|
* Copyright (c) 2019-2023, yzrh <yzrh@noema.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
@ -108,19 +108,22 @@ static void*
|
||||||
handler_rendering(void *args)
|
handler_rendering(void *args)
|
||||||
{
|
{
|
||||||
const SDL_Color fg = {
|
const SDL_Color fg = {
|
||||||
COLOUR_FOREGROUND_R,
|
.r = COLOUR_FOREGROUND_R,
|
||||||
COLOUR_FOREGROUND_G,
|
.g = COLOUR_FOREGROUND_G,
|
||||||
COLOUR_FOREGROUND_B
|
.b = COLOUR_FOREGROUND_B,
|
||||||
|
.a = 255
|
||||||
};
|
};
|
||||||
const SDL_Color bg = {
|
const SDL_Color bg = {
|
||||||
COLOUR_BACKGROUND_R,
|
.r = COLOUR_BACKGROUND_R,
|
||||||
COLOUR_BACKGROUND_G,
|
.g = COLOUR_BACKGROUND_G,
|
||||||
COLOUR_BACKGROUND_B
|
.b = COLOUR_BACKGROUND_B,
|
||||||
|
.a = 255
|
||||||
};
|
};
|
||||||
const SDL_Color bg_s = {
|
const SDL_Color bg_s = {
|
||||||
COLOUR_BACKGROUND_SHADE_R,
|
.r = COLOUR_BACKGROUND_SHADE_R,
|
||||||
COLOUR_BACKGROUND_SHADE_G,
|
.g = COLOUR_BACKGROUND_SHADE_G,
|
||||||
COLOUR_BACKGROUND_SHADE_B
|
.b = COLOUR_BACKGROUND_SHADE_B,
|
||||||
|
.a = 255
|
||||||
};
|
};
|
||||||
|
|
||||||
char result_str[23];
|
char result_str[23];
|
||||||
|
@ -941,7 +944,7 @@ int
|
||||||
main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
printf("Snake " VERSION "." RELEASE "." PATCH EXTRA "\n"
|
printf("Snake " VERSION "." RELEASE "." PATCH EXTRA "\n"
|
||||||
"Copyright (c) 2019-2020, yzrh <yzrh@noema.org>\n");
|
"Copyright (c) 2019-2022, yzrh <yzrh@noema.org>\n");
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO |
|
if (SDL_Init(SDL_INIT_VIDEO |
|
||||||
SDL_INIT_AUDIO |
|
SDL_INIT_AUDIO |
|
||||||
|
@ -1415,8 +1418,7 @@ main(void)
|
||||||
text_score.cache = 0;
|
text_score.cache = 0;
|
||||||
|
|
||||||
if (flappy) {
|
if (flappy) {
|
||||||
delay.tv_nsec = TICK_TIME_INIT /
|
delay.tv_nsec /= SCREEN_UNIT;
|
||||||
SCREEN_UNIT;
|
|
||||||
|
|
||||||
game_snake_init(&snake0, 0);
|
game_snake_init(&snake0, 0);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2020, yzrh <yzrh@noema.org>
|
* Copyright (c) 2019-2022, yzrh <yzrh@noema.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
@ -7,4 +7,4 @@
|
||||||
#define VERSION "0"
|
#define VERSION "0"
|
||||||
#define RELEASE "6"
|
#define RELEASE "6"
|
||||||
#define PATCH "2"
|
#define PATCH "2"
|
||||||
#define EXTRA "_4"
|
#define EXTRA "_7"
|
||||||
|
|
Loading…
Add table
Reference in a new issue