Browse Source

stub laydown

main
KikooDX 5 months ago
parent
commit
6e3c729758
  1. 10
      .clang-format
  2. 12
      .gitignore
  3. 24
      CMakeLists.txt
  4. 115
      inc/lzy.h
  5. 28
      meson.build
  6. 3
      res/fxconv-metadata.txt
  7. BIN
      res/icon-sel.png
  8. BIN
      res/icon-uns.png
  9. 19
      src/main.c

10
.clang-format

@ -0,0 +1,10 @@
BasedOnStyle: LLVM
IndentWidth: 8
UseTab: AlignWithSpaces
BreakBeforeBraces: Attach
AllowShortIfStatementsOnASingleLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: Empty
IndentCaseLabels: false
ColumnLimit: 80
AlignConsecutiveMacros: true

12
.gitignore vendored

@ -0,0 +1,12 @@
# Build files
/build*
/*.g1a
/*.g3a
# Python bytecode
__pycache__/
# Common IDE files
*.sublime-project
*.sublime-workspace
.vscode

24
CMakeLists.txt

@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.22)
project(lzy)
include(GenerateG3A)
include(Fxconv)
find_package(Gint 2.7.0 REQUIRED)
include_directories(inc)
set(SOURCES
src/main.c
)
set(ASSETS
)
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 "lzy.g3a"
NAME "lzy" ICONS res/icon-uns.png res/icon-sel.png)

115
inc/lzy.h

@ -0,0 +1,115 @@
#ifndef LZY_H_
#define LZY_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
int LZY_Init(void);
int LZY_Deinit(void);
int LZY_DrawBegin(void);
int LZY_DrawEnd(void);
void LZY_DrawSetColor(uint8_t r, uint8_t g, uint8_t b);
int LZY_DrawClear(void);
void LZY_CycleEvents(void);
int LZY_KeyDown(unsigned int scancode);
const char *LZY_GetError(void);
#ifdef FXCG50
#include <gint/keycodes.h>
enum LZY_ScanCode {
LZY_SC_ESCAPE = KEY_EXIT,
};
#else /* end FXCG50, begin SDL2 */
#include <SDL.h>
enum LZY_ScanCode {
LZY_SC_ESCAPE = SDLK_ESCAPE,
};
#endif /* SDL2 */
#ifdef __cplusplus
}
#endif
#endif /* LZY_H_ */
/* implementation */
#ifdef LZY_IMPLEMENTATION
#ifndef LZY_TILE_SIZE
#define LZY_TILE_SIZE 16
#endif
#ifdef FXCG50
#include <gint/display.h>
#include <stdint.h>
static color_t draw_color;
int LZY_Init(void) {
return 0;
}
int LZY_Deinit(void) {
return 0;
}
int LZY_DrawBegin(void) {
return 0;
}
int LZY_DrawEnd(void) {
return 0;
}
void LZY_DrawSetColor(uint8_t r, uint8_t g, uint8_t b) {
draw_color = C_RGB(r << 3, g << 3, b << 3);
}
int LZY_DrawClear(void) {
return 0;
}
void LZY_CycleEvents(void) {}
int LZY_KeyDown(unsigned int scancode) {
return 0;
}
const char *LZY_GetError(void) {
return NULL;
}
#else /* end FXCG50, begin SDL2 */
#include <SDL.h>
#include <stdint.h>
int LZY_Init(void) {
return 0;
}
int LZY_Deinit(void) {
return 0;
}
int LZY_DrawBegin(void) {
return 0;
}
int LZY_DrawEnd(void) {
return 0;
}
void LZY_DrawSetColor(uint8_t r, uint8_t g, uint8_t b) {}
int LZY_DrawClear(void) {
return 0;
}
void LZY_CycleEvents(void) {}
int LZY_KeyDown(unsigned int scancode) {
return 0;
}
const char *LZY_GetError(void) {
return NULL;
}
#endif /* SDL2 */
#endif /* LZY_IMPLEMENTATION */

28
meson.build

@ -0,0 +1,28 @@
project('lzy', 'c')
cc = meson.get_compiler('c')
sdl2deps = [
dependency('sdl2', version: '>=2.0.0'),
dependency('SDL2_image', version: '>=2.0.0'),
cc.find_library('m', required: true),
cc.find_library('dl', required: true),
]
inc = include_directories('inc')
sources = [
'src/main.c',
]
c_flags = [
'-std=c99', '-Os',
'-Wall', '-Wextra',
]
executable('lzy',
sources,
include_directories : inc,
dependencies : sdl2deps,
install: false,
c_args : c_flags)

3
res/fxconv-metadata.txt

@ -0,0 +1,3 @@
tset.png:
type: bopti-image
name: bimg_tset

BIN
res/icon-sel.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
res/icon-uns.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1010 B

19
src/main.c

@ -0,0 +1,19 @@
#define LZY_IMPLEMENTATION
#include "lzy.h"
int main(void) {
if (LZY_Init())
return 1;
LZY_DrawSetColor(255, 0, 0);
LZY_DrawBegin();
LZY_DrawClear();
LZY_DrawEnd();
do {
LZY_CycleEvents();
} while (!LZY_KeyDown(LZY_SC_ESCAPE));
return 1;
}
Loading…
Cancel
Save