Skip to content

Commit

Permalink
new: RGB3(), RGB4(), udp_sendto(), window_icon(), sprite_update(), ap…
Browse files Browse the repository at this point in the history
…p_name(), time_us(), sleep_us()

rename: sprite()->tile(), sprite_ex()->sprite(), time_human()->date_human(), ui_bool/float/string_const()->ui_const_bool/float/string()
fix: Fix #9, Fix compilation on vanilla windows (no msvc, no gcc); embed vc140 runtime deps for ass2iqe.exe
  • Loading branch information
r-lyeh committed Sep 6, 2021
1 parent 18d5448 commit 3115d8b
Show file tree
Hide file tree
Showing 8 changed files with 235 additions and 146 deletions.
17 changes: 10 additions & 7 deletions MAKE.bat
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,18 @@ if "%Platform%"=="" (
) else if exist "%ProgramFiles(x86)%/microsoft visual studio/2019/community/VC/Auxiliary/Build/vcvarsx86_amd64.bat" (
@call "%ProgramFiles(x86)%/microsoft visual studio/2019/community/VC/Auxiliary/Build/vcvarsx86_amd64.bat"
) else (
set Platform=mingw64
echo Warning: Could not find x64 environment variables for Visual Studio 2019/2017/2015/2013. Trying MingW64...

cd "%~dp0"
gcc.exe 1> nul 2> nul
if "%ERRORLEVEL%"=="9009" (
where /q gcc
if "%ERRORLEVEL%"=="1" (
set Platform=tcc
echo Warning: Mingw64 not found. Trying tcc...
)
echo Warning: Trying x64 environment variables for Visual Studio 2019/2017/2015/2013 ...
echo Warning: Trying Mingw64 ...
echo Warning: Trying TCC ...
) else (
set Platform=mingw64
echo Warning: Trying x64 environment variables for Visual Studio 2019/2017/2015/2013 ...
echo Warning: Trying Mingw64 ...
)
)
)

Expand Down
123 changes: 70 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- [x] ~Full featured~. Small.
- [x] ~Royaltie fee~. Free and unlicensed.

## Features ᕦ(ᐛ)ᕤ (stuff done ~~and yet to do~~)
## Features ᕦ(ᐛ)ᕤ (stuff done ~~and yet to be done~~)
- [x] OS: Windows, Linux and OSX.
- [x] Compiler: MSVC, MINGW64, TCC, GCC and clang.
- [x] Window: fullscreen, msaa, cursor handling.
Expand All @@ -39,87 +39,104 @@
- [x] Scene handling.
- [x] Integrated asset pipeline.
- [x] Profiler, stats and leaks finder.
- [x] Level data: JSON5 ~~and XML~~.
- [x] Level data: JSON, JSON5, SJSON, XML.

## Roadmap ᕕ(ᐛ)ᕗ (in order of arrival)
- [ ] Network: message api and pub/sub wrappers.
- [ ] Script: Teal and typescript.
## Roadmap ᕕ(ᐛ)ᕗ (in order of arrival; `*` partial support)
- [ ] Network: message api and pub/sub wrappers (enet/websocket).
- [ ] Script: DLL, Teal and TypeScript.
- [ ] Script: Refl/meta binding tool (during cook stage).
- [ ] Level editor: gizmos, ~~scene tree, property editor, load/save~~.
- [ ] Level objects: ~~volumes, triggers, platforms, streaming~~.
- [ ] Render: Materials (textures, matcaps, videos, shadertoys).
- [ ] Level editor: gizmos`*`, scene tree, property editor, load/save, undo/redo, copy/paste.
- [ ] Level objects: volumes, triggers, platforms, streaming.
- [ ] Render: Materials (colors, textures, matcaps`*`, videos, shadertoys`*`).
- [ ] Render: Shadow mapping and baked lightmaps.
- [ ] Pipeline: Extend configurable asset pipeline (shaders, bindings, xml, textures). Asset options.
- [ ] API: Review API and lock it.
- [ ] API: Documentation.
- [ ] API: More examples.
- [ ] Pipeline: Make asset pipeline configurable. Extend: shaders, bindings, textures. Per-type, per-asset options.
- [ ] Maybe: Animation pass.
- [ ] Maybe: AI/Logic pass.
- [ ] Maybe: Lighting/PBR pass.
- [ ] Maybe: VM/ECS/Replication pass.
- [ ] Maybe: PBR pass.
- [ ] API: More examples.
- [ ] API: Documentation. Generator (during cook stage).
- [ ] API: Review API, clean it up and lock it.

<!--
//
// almost done:
// [x] shadertoy textures
// [ ] xml
// [ ] billboards
// [ ] soft shadows (vsm, vsmcube)
// [ ] enet, websocket
//
// roadmap:
// 1) lighting: vsm,vsmcube (per @procedural's request)
// 2d: billboards
// 2) fixing leaks
// extending asset pipeline
// cook: img2png (spot, stbi), tex2pvr (spot, soil2)
// cook: hlsl2glsl (XShaderCompiler), hlsl2spirv (dxc), spirv2many (spirv-cross), glsl2many (sokol-shdc)
// cook: ogg2wav, mp32wav, mp22wav, flac2wav
// cook: xml2json, mp2json
// cook: tiled2json, spine2json, tlfx22json
// 3) lock API and release first stable version.
// modules: script or dll + ram load/save/diff/patch + play/stop/init/ + attach/detach
// logic tree/ << [] |> || >>
// - scene |>
// - enemies
// nice to have:
// [ ] fixed leaks
// [ ] fwk_app: app state manager, options, app icon, cpu usage, battery, orientation
// [ ] fwk_input: cursor, mouse clip, mouse wrap,
// [ ] sprites: pixel perfect zooming (demo+wheel)
// [ ] zip0 seek-vfs optimization
-->

<!--
//[ ] Script: Teal and typescript.
//[ ] Script: Refl/meta binding tool (during cook stage).
// fwk_cook (*.c, *.h) as .proto/.pbc maybe, free reflection+automatic bindings
//[ ] Level editor: gizmos, ~~scene tree, property editor, load/save~~.
// 4) (json) editor: load/save jsons, property editor for anything (remote osc server/client)
// cam: friction, projections (dimetric, isometric, ...)
// gizmo: proportional, arcball XY (+shift for Z/tilt)
// scene: scenegraph, obj naming, ~~obj picking, obj bounds,~~ obj collisions, obj/scene streaming
// ecs: sys are modules, ecs: messaging, ecs: filesystem (e/dir,c/files,s/dll)
// world: streaming, migration
// gfx: tessellation
// placeholders google
// vcs
// X) level
// scripts: states, signals, h/fsm, coroutines, load/save context
// ai: h/fsm for level objects and small enemies, planning GOAL, BTrees,
// nav: navpaths, waypoints, navigation, pathfinding (jps.hh), a*, swarm/flocks,
// physics: emitters: particles, lights, lightmaps, sound sources, triggers, etc
//[ ] Level objects: ~~volumes, triggers, platforms, streaming~~.
// level: emitters: particles, lights, lightmaps, sound sources, triggers, etc
// level: box triggers, start/end, spawn, streaming, checkpoints,
// level: jump, shoots, platforms, collisions
// level: 60s, 70s, 80s, 90s
//[ ] Render: Materials (textures, matcaps, videos, shadertoys).
// material: fixed color, texture or script that returns color
// animated textures (shadertoys)
//[ ] Render: Shadow mapping and baked lightmaps.
// [ ] soft shadows (vsm, vsmcube)
//[ ] Pipeline: Extend configurable asset pipeline (shaders, bindings, xml, textures). Asset options.
// extending asset pipeline
// cook: img2png (spot, stbi), tex2pvr (spot, soil2)
// cook: hlsl2glsl (XShaderCompiler), hlsl2spirv (dxc), spirv2many (spirv-cross), glsl2many (sokol-shdc)
// cook: ogg2wav, mp32wav, mp22wav, flac2wav
// cook: xml2json, mp2json
// cook: tiled2json, spine2json, tlfx22json
//[ ] Maybe: Animation pass.
// 6) anims, I (playlist: forward/backwards/loop/rewind), II (blend/shapes), III (ik/bone), IV (graph/controller)
// blend anims, animtracks+animevents, draw skeleton, additive anims,
// fwk_data: quantization: ~~half, quant, microfloat~~.
// anim; keyframes[] { frame+delay,frame+delay,... }, anim duration, anim flip
//[ ] Maybe: AI/Logic pass.
// scripts: states, signals, h/fsm, coroutines, load/save context
// ai: h/fsm for level objects and small enemies, planning GOAL, BTrees,
// nav: navpaths, waypoints, navigation, pathfinding (jps.hh), a*, swarm/flocks,
//[ ] Maybe: VM/ECS/Replication pass.
// 8) vm/ecs core + engines: custom frontends & backends
// vm: ram, workqueues, threading, priorities, load/save
// service protocols: websocket bqqbarbhg/bq_websocket, https, handshake
// databases, services, quotas, black/whitelists, etc
//[ ] Core: wecs+replication
// modules: script or dll + ram load/save/diff/patch + play/stop/init/ + attach/detach
// logic tree/ << [] |> || >>
// - scene |>
// - enemies
// ecs: sys are modules, ecs: messaging, ecs: filesystem (e/dir,c/files,s/dll)
// world: streaming, migration
// 7) network replication & messaging
// network: replication, dead reckoning, interpolation, extrapolation, bandwidth
// network: messaging: un/reliable, fragmentation, priority, etc
// network: topologies: bus, star, p2p, pubsub, etc
// network: filesystem
// int send_game_state(void *ptr, int len, int flags); PROTOCOL_V1|QUANTIZE|COMPRESS|RLE
// int recv_game_state(); compensate, extrapolate, intrapolate(); lerp();
// 8) vm/ecs core + engines: custom frontends & backends
// vm: ram, workqueues, threading, priorities
// service protocols: websocket bqqbarbhg/bq_websocket, https, handshake
// databases, services, quotas, black/whitelists, etc
//[ ] Maybe: Lighting/PBR pass.
// 9) render+
// lighting: vsm,vsmcube (per @procedural's request)
// 2d: billboards
// PBR/IBL/materials (from Foxotron+sgorsten) + shading models
// lightmapping/xatlas (demos), reflection probes
// instancing, frustum culling, impostors, mesh lods,
// renderbuckets
// decals
// tessellation
// 2d: spines, particles (tlfx2)
// reverse-z {
// fbo attach format D16_UNORM -> D32_SFLOAT
Expand All @@ -128,19 +145,18 @@
// proj matrix: float a = zfar / (zfar - znear); -> float a = -znear / (zfar - znear);
// proj matrix: float b = (-znear * zfar) / (zfar - znear); -> float b = (znear * zfar) / (zfar - znear);
// }
//10) fwk_app: app state manager, options, app icon, cpu usage, battery, orientation
// fwk_input: cursor, mouse clip, mouse wrap,
// animated textures (shadertoys)
// sprites: pixel perfect zooming (demo+wheel)
// zip0 seek-vfs optimization
// 11) fwk_cook (*.c, *.h) as .proto/.pbc maybe, free reflection+automatic bindings
//[ ] API: Review API and lock it.
// 3) lock API and release first stable version.
//[ ] API: Documentation.
//src2doc
//[ ] API: More examples.
-->


## Build
Type `MAKE.bat` (Win) or `sh MAKE.bat` (Linux/OSX) to build everything. Alternatively,

```bash
```lua
echo Windows (vc+tcc) && cl demo.c fwk.c
echo Windows (mingw64) && gcc demo.c fwk.c -o demo -w -lws2_32 -lgdi32 -lwinmm -ldbghelp -std=c99
echo Linux (gcc+clang+tcc) && cc demo.c fwk.c -o demo -w -lm -ldl -lpthread
Expand All @@ -153,7 +169,8 @@ echo OSX (gcc+clang) && cc demo.c -ObjC fwk.c -o demo -w -framework cocoa
- Split FWK into separate files by running `art/tools/split.bat` (or `sh art/tools/split.bat` in Linux/OSX).
- Merge those files back into FWK by running `art/tools/join.bat` (or `sh art/tools/join.bat` in Linux/OSX).
- Optionally, generate a single-header distribution by executing following script:
```bash

```lua
type fwk.h > fwk-single-header.h
echo #ifdef FWK_C >> fwk-single-header.h
echo #pragma once >> fwk-single-header.h
Expand Down
Binary file added art/tools/msvcp140.dll
Binary file not shown.
Binary file added art/tools/vcruntime140.dll
Binary file not shown.
Binary file added art/tools/vcruntime140_1.dll
Binary file not shown.
6 changes: 3 additions & 3 deletions demo_sprite.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ void demo_cats() {
// Get x scale based on flip flag
int xscale = yscale * (c->flip ? -1 : 1);
// Draw
sprite_ex(catImage,
sprite(catImage,
c->x,c->y,c->y, 0, // position(x,y,depth: sort by Y), angle
0,0, xscale,yscale, // offset(x,y), scale(x,y)
0,white, // is_additive, tint color
frame_num, 8,4 // frame_number in a 8x4 spritesheet
);
sprite_ex(shadowImage,
sprite(shadowImage,
c->x,c->y,-c->y, 0, // position(x,y,depth: sort by Y), angle
-1,5, xscale,yscale, // offset(x,y), scale(x,y)
0,alpha, // is_additive, tint color
Expand Down Expand Up @@ -125,7 +125,7 @@ void demo_kids() {
int col = ((x[i] / 10) % 4); // 4x4 tilesheet
int row = ((y[i] / 10) % 4);
int num_frame = col * 4 + row;
sprite_ex(kids,
sprite(kids,
x[i],y[i],y[i], angle, // position(x,y,depth: sort by Y), angle
0,0, 1,1, // offset(x,y), scale(x,y)
0, ~0u, // is_additive, tint color
Expand Down
Loading

0 comments on commit 3115d8b

Please sign in to comment.