lnvis

nanovg lightning network visualizer
git clone git://jb55.com/lnvis
Log | Files | Refs | README | LICENSE

commit 7be58353ddb24876a6dfb46947c630764dc28b9a
parent 06575abeb1424e9a52c7ac128178da95e28e5c1b
Author: William Casarin <jb55@jb55.com>
Date:   Fri,  3 Aug 2018 13:16:51 -0700

progress

Diffstat:
AMakefile | 26++++++++++++++++++++++++++
Adefs.h | 15+++++++++++++++
Mmain.c | 53++++++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 93 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile @@ -0,0 +1,26 @@ + +BIN = lnvis +PREFIX ?= /usr/local +CFLAGS = -ggdb -Os -Wall -Werror -Wextra -std=c99 + +LDFLAGS = -lSDL -lGL + +DEPS = main.o + +include $(OBJS:.o=.d) + +%.d: %.c + $(CC) -MM $(CFLAGS) $< > $@ + +all: $(BIN) + +$(BIN): main.o + $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@ + +format: fake + clang-format -i *.c + +clean: fake + rm -f $(DEPS) + +.PHONY: fake diff --git a/defs.h b/defs.h @@ -0,0 +1,15 @@ + +#ifndef LNVIS_DEFS_H +#define LNVIS_DEFS_H + +typedef unsigned char u8; +typedef signed char s8; + +typedef unsigned short u16; +typedef signed short s16; + +typedef unsigned int u32; +typedef signed int s32; + +#endif /* LNVIS_DEFS_H */ + diff --git a/main.c b/main.c @@ -1,6 +1,57 @@ +#include <SDL2/SDL.h> +#include <GL/gl.h> + +#include "defs.h" + +struct ln { +}; + +static void process_events() +{ + //const u8 *keystates = SDL_GetKeyboardState(NULL); +} + +static void update(struct ln *ln) +{ + (void)ln; +} + +static void render(struct ln *ln) +{ + (void)ln; +} + int main(int argc, char *argv[]) { + (void)argc; + (void)argv; + + int width = 640; + int height = 480; + struct ln ln; + + SDL_Window *window = + SDL_CreateWindow("Lightning Network Visualizer", 0, 0, width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE); + + SDL_GL_CreateContext(window); + + u32 last = SDL_GetTicks(); + + while (1) { + process_events(); + u32 ticks = SDL_GetTicks(); + update(&ln); + + last = ticks; + (void)last; + render(&ln); + + /* Swap front and back buffers */ + SDL_GL_SwapWindow(window); + } - return 0; + return 0; }