emulator-template: Add full emulator-only template package, fix Conway starting paused
Complete self-contained SDL3 emulator-only template for prototyping sketches without hardware: - Makefile: single-TU build (host + sketch), run/smoke/clean targets - shim.h: minimal Arduino API shim (millis, random, String, GPIO stubs) - src/main.cpp: SDL3 host loop presenting emuGfx::fb, CLI frame dumps - examples/Conway: Conway.cpp sketch + .ino reference copy - .gitignore: exclude built binaries and captured BMP frames The Conway sketch previously started with paused=true, which prevented render() from being called each frame, leaving the framebuffer all-black and resulting in a black SDL3 window. Changed to paused=false so the simulation runs immediately.
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
# Minimal Makefile for the T-Deck emulator-only template.
|
||||
# Build & run: make run (from this directory)
|
||||
# Smoke test: make smoke
|
||||
#
|
||||
# This Makefile is self-contained: all sources (shim, main, sketch)
|
||||
# are relative to this Makefile's directory. Copy the whole folder
|
||||
# for a new project — no path adjustments needed.
|
||||
|
||||
APP ?= Conway
|
||||
APP_DIR := examples/$(APP)
|
||||
|
||||
# SDL3 flags via pkg-config
|
||||
SDLFLAGS := $(shell pkg-config --cflags sdl3 sdl3-ttf)
|
||||
LIBS := $(shell pkg-config --libs sdl3 sdl3-ttf)
|
||||
|
||||
CXX ?= g++
|
||||
CXXFLAGS ?= -std=gnu++17 -O2 -Wall -Wextra
|
||||
|
||||
# Include current directory for shim.h, and the sketch directory
|
||||
INC := -I . -I $(APP_DIR)
|
||||
|
||||
# Preprocessor definitions: the .ino filename and app name
|
||||
DEFS += -DAPP_INO='"$(APP).ino"' -DAPP_NAME='"$(APP)"'
|
||||
|
||||
# Source files — the sketch .cpp is included by main.cpp via #include,
|
||||
# so they compile as a single translation unit.
|
||||
SHIMS := $(wildcard *.h) # picks up shim.h at template root
|
||||
|
||||
# Main entry point for this template (standalone, no HW deps)
|
||||
# main.cpp includes examples/Conway/Conway.cpp forming one TU.
|
||||
EMU_MAIN := src/main.cpp
|
||||
|
||||
EMU := $(APP)-emu
|
||||
|
||||
all: $(EMU)
|
||||
|
||||
# Compile + link: main.cpp includes the sketch .cpp, forming one TU.
|
||||
# -DAPP_INO makes the sketch's .ino filename available to #ifdef EMULATOR.
|
||||
$(EMU): $(EMU_MAIN) $(SHIMS)
|
||||
$(CXX) $(CXXFLAGS) $(SDLFLAGS) $(INC) $(DEFS) \
|
||||
$(EMU_MAIN) -o $@ $(LIBS)
|
||||
|
||||
run: $(EMU)
|
||||
./$(EMU)
|
||||
|
||||
smoke: $(EMU)
|
||||
./$(EMU) --frames 240 --dump smoke_frame.bmp
|
||||
|
||||
clean:
|
||||
rm -f $(EMU)
|
||||
|
||||
.PHONY: all run smoke clean
|
||||
Reference in New Issue
Block a user