art
This commit is contained in:
commit
9ea7bf73bb
|
@ -0,0 +1,9 @@
|
|||
BasedOnStyle: LLVM
|
||||
IndentWidth: 8
|
||||
UseTab: AlignWithSpaces
|
||||
BreakBeforeBraces: Linux
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
IndentCaseLabels: false
|
||||
ColumnLimit: 80
|
||||
AlignConsecutiveMacros: true
|
|
@ -0,0 +1,27 @@
|
|||
cmake_minimum_required(VERSION 3.22)
|
||||
project(wehfou)
|
||||
|
||||
include(GenerateG3A)
|
||||
include(Fxconv)
|
||||
find_package(Gint 2.7.0 REQUIRED)
|
||||
|
||||
include_directories(inc)
|
||||
|
||||
set(SOURCES
|
||||
src/main.c
|
||||
src/lzy.c
|
||||
)
|
||||
|
||||
set(ASSETS
|
||||
res/tset.png
|
||||
res/font.png
|
||||
)
|
||||
|
||||
fxconv_declare_assets(${ASSETS} WITH_METADATA)
|
||||
|
||||
add_executable(thyaddin ${SOURCES} ${ASSETS})
|
||||
target_compile_options(thyaddin PRIVATE -Wall -Wextra -Os)
|
||||
target_link_libraries(thyaddin Gint::Gint)
|
||||
|
||||
generate_g3a(TARGET thyaddin OUTPUT "wehfou.g3a"
|
||||
NAME "wehfou" ICONS res/icon-uns.png res/icon-sel.png)
|
|
@ -0,0 +1,34 @@
|
|||
CC ?= gcc
|
||||
CFLAGS = -std=c99 -Wall -Wextra -O3 -I./inc -MMD $(shell sdl2-config --cflags)
|
||||
LDFLAGS = -lSDL2 -lSDL2_image -lSDL2_mixer $(shell sdl2-config --libs)
|
||||
|
||||
OBJ_NAME = wehfou
|
||||
OBJS := $(patsubst %.c,%.o,$(wildcard src/*.c))
|
||||
|
||||
all: $(OBJ_NAME)
|
||||
|
||||
$(OBJ_NAME): $(OBJS)
|
||||
$(CC) $(LDFLAGS) $(LIBRARIES) -o $(OBJ_NAME) $(OBJS)
|
||||
strip $(OBJ_NAME)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
cg:
|
||||
fxsdk build-cg
|
||||
|
||||
run: $(OBJ_NAME)
|
||||
./$(OBJ_NAME)
|
||||
|
||||
format:
|
||||
@clang-format -style=file -verbose -i src/*.c
|
||||
@clang-format -style=file -verbose -i inc/*.h
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ_NAME).g3a $(OBJ_NAME)
|
||||
rm -f $(OBJS) src/*.d
|
||||
rm -Rf build-cg
|
||||
|
||||
.PHONY: cg run run-txt format clean
|
||||
|
||||
-include src/*.d
|
|
@ -0,0 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#define CHR_WIDTH 8
|
||||
#define CHR_HEIGHT 16
|
||||
#define DISPLAY_WIDTH 400
|
||||
#define DISPLAY_HEIGHT 224
|
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
void player_init(float x, float y);
|
||||
void player_draw(void);
|
||||
|
||||
#define PLAYER_WIDTH 12
|
||||
#define PLAYER_HEIGHT 12
|
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
|
@ -0,0 +1,7 @@
|
|||
tset.png:
|
||||
type: bopti-image
|
||||
name: bimg_tset
|
||||
font.png:
|
||||
type: bopti-image
|
||||
name: bimg_font
|
||||
profile: p4
|
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 1010 B |
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
|
@ -0,0 +1,10 @@
|
|||
#include "conf.h"
|
||||
#define LZY_IMPLEMENTATION
|
||||
#define LZY_GINT_TILESET bimg_tset
|
||||
#define LZY_GINT_FONT bimg_font
|
||||
#define LZY_CHR_WIDTH CHR_WIDTH
|
||||
#define LZY_CHR_HEIGHT CHR_HEIGHT
|
||||
#define LZY_DISPLAY_WIDTH DISPLAY_WIDTH
|
||||
#define LZY_DISPLAY_HEIGHT DISPLAY_HEIGHT
|
||||
#define LZY_FIRST_CHR ' '
|
||||
#include "lzy.h"
|
|
@ -0,0 +1,50 @@
|
|||
#include "conf.h"
|
||||
#include "lzy.h"
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
if (LZY_Init(argc, argv, "wehfou official goty", 30, "res/tset.png",
|
||||
"res/font.png")) {
|
||||
LZY_Log(LZY_GetError());
|
||||
LZY_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (!LZY_ShouldQuit()) {
|
||||
/* update */
|
||||
LZY_CycleEvents();
|
||||
|
||||
if (LZY_KeyDown(LZYK_LEFT))
|
||||
x -= 2;
|
||||
if (LZY_KeyDown(LZYK_RIGHT))
|
||||
x += 2;
|
||||
if (LZY_KeyDown(LZYK_UP))
|
||||
y -= 2;
|
||||
if (LZY_KeyDown(LZYK_DOWN))
|
||||
y += 2;
|
||||
|
||||
/* draw */
|
||||
LZY_DrawBegin();
|
||||
{
|
||||
/* draw background */
|
||||
LZY_DrawTileEx(0, 0, 0, 13, 7);
|
||||
LZY_DrawTileEx(0, DISPLAY_WIDTH / 2, 0, 13, 7);
|
||||
LZY_DrawTileEx(0, 0, DISPLAY_HEIGHT / 2, 13, 7);
|
||||
LZY_DrawTileEx(0, DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2,
|
||||
13, 7);
|
||||
|
||||
/* draw player */
|
||||
if (LZY_DrawChar('s', x, y))
|
||||
LZY_Log(LZY_GetError());
|
||||
}
|
||||
LZY_DrawEnd();
|
||||
}
|
||||
|
||||
LZY_Log("cya");
|
||||
LZY_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
#include "player.h"
|
||||
#include "lzy.h"
|
||||
|
||||
static float x, y, spd_x, spd_y;
|
||||
|
||||
void player_init(float nx, float ny)
|
||||
{
|
||||
x = nx;
|
||||
y = ny;
|
||||
spd_x = 0.0f;
|
||||
spd_y = 0.0f;
|
||||
}
|
||||
|
||||
void player_draw(void)
|
||||
{
|
||||
LZY_DrawSetColor(255, 0, 255);
|
||||
LZY_DrawFillRect(x, y, PLAYER_WIDTH, PLAYER_HEIGHT);
|
||||
}
|
Loading…
Reference in New Issue