{"id":26218070,"url":"https://github.com/krafpy/4k-intro-template","last_synced_at":"2025-03-12T13:15:18.325Z","repository":{"id":231486852,"uuid":"711274990","full_name":"Krafpy/4k-intro-template","owner":"Krafpy","description":"Example and template for a basic 4k intro.","archived":false,"fork":false,"pushed_at":"2024-08-28T13:34:38.000Z","size":229,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-28T14:57:41.308Z","etag":null,"topics":["demoscene"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Krafpy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-28T18:29:47.000Z","updated_at":"2024-08-28T13:34:42.000Z","dependencies_parsed_at":"2024-08-28T14:56:10.198Z","dependency_job_id":"b42c6b25-8ef0-4d2b-a873-c5033b1feab8","html_url":"https://github.com/Krafpy/4k-intro-template","commit_stats":null,"previous_names":["krafpy/4k-intro-template"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Krafpy%2F4k-intro-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Krafpy%2F4k-intro-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Krafpy%2F4k-intro-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Krafpy%2F4k-intro-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Krafpy","download_url":"https://codeload.github.com/Krafpy/4k-intro-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243222184,"owners_count":20256229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["demoscene"],"created_at":"2025-03-12T13:15:17.546Z","updated_at":"2025-03-12T13:15:18.304Z","avatar_url":"https://github.com/Krafpy.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 4k intro template\n\nThis is (yet another) example minimal template for building 4kB\n[intros](https://en.wikipedia.org/wiki/Demoscene) (but can apply\nto other sizes as well) on Windows, with an emphasis on being\n*educational and beginner-friendly*, and will eventually improve over time.\nIt was initially inspired by\n[Inigo Quilez's (iq) templates](https://madethisthing.com/iq/Demo-Framework-4k)\nfor 4k shader-based intros, but with a more explicit\ncode and lots of comments. It is a command-line only alternative to existing\nframeworks and only requires Visual Studio Build Tools and common\ndemoscene tools to be installed. This was\nmade in order to clearly detail the compilation process without\nMSBuild/Visual Studio's automation. For more robust and Visual Studio compatible frameworks,\nyou probably want to look into iq's one or\n[Leviathan](https://github.com/armak/Leviathan-2.0).\n\nFor complete beginners to demoscene, check out this article on how to\n[*Teach Yourself Demoscene in 14 Days*](https://github.com/psenough/teach_yourself_demoscene_in_14_days).\n\nThis template itself contains a very simple example intro that\ncan be built and run directly.\nThe rendering and music generation is mostly based on iq's example,\nbut the synthetizer is custom made (and probably a bad example).\nOf course, when designing a production demo, you will want adapt,\ninline, rewrite or remove some of the code here in addition to writing your own.\n\n## File structure\n\n- `shaders/`: the shaders' sources, minified into `shaders.inl` during build;\n- `main.c`: entrypoint, creates the window and starts the music and rendering loop;\n- `config.h`: global settings;\n- `glext.h`, `khrplatform.h`: self-contained interfaces of OpenGL functions;\n- `fp.h`: useful set of approximate floats ([by iq](https://iquilezles.org/articles/float4k/));\n- `intro.h`/`intro.c`: rendering initialisation and update;\n- `synth.h`/`synth.c`: functions for the audio synthetizer;\n- `music.h`/`music.c`: music generation.\n- `stb_image_write.h`/`stb_image_write.c`: used to save frames to png,\n    taken from [stb](https://github.com/nothings/stb);\n- `capture.h`/`capture.c`: set of functions used for video capture\n\n## Build\n\n### Building the intro\n\nThe compilation tricks to generate a small executable follow the recommandations described\nin [this article by iq](https://iquilezles.org/articles/compilingsmall/), with some updates.\nAll the build process is contained in the `build.ps1` PowerShell script and uses\ncustom minimal JSON configuration files. By default, the `debug.json` configuration is used.\nYou can add your own for specific configurations.\n\nBuilding the project requires the following tools to be installed and accessible via a\nPowerShell command line (e.g. in PATH):\n\n- Microsoft Visual C++ compiler `cl.exe` and linker `link.exe` for x86\n(e.g. using the Powershell Developer Command Prompt). These are bundled in the the\n[Build Tools for Visual Studio](https://visualstudio.microsoft.com/downloads/?q=build+tools+for+visual+studio)\n(note that you don't need to install Visual Studio itself).\n- [`crinkler`](https://github.com/runestubbe/Crinkler)\n- [`shader_minifier`](https://github.com/laurentlb/Shader_Minifier)\n\nIf you are using an antivirus software (Windows Defender included),\nit is likely to detect the compiled executable as\na [trojan](https://en.wikipedia.org/wiki/Trojan_horse_(computing)).\nYou'll need to whitelist the file or the entire folder in your antivirus before compiling or running it.\n\nBuild an uncompressed debug version (uses MSVC's linker):\n\n```powershell\n.\\build.ps1\n```\n\nor the compressed release (uses crinkler):\n\n```powershell\n.\\build.ps1 .\\release.json\n```\n\nand run:\n\n```powershell\n.\\main.exe\n```\n\nTo see all the build options enter:\n\n```powershell\nGet-Help .\\build.ps1\n```\n\n### Video capture\n\nThis requires [`ffmpeg`](https://ffmpeg.org/) to be installed and accessible via the command line.\nBuild the intro with the `-Capture` flag, and run the generated executable:\n\n```powershell\n.\\capture_main.exe\n```\n\nNote that the capture executable is non-compressed and fullscreen debug mode.\nOnce capture is complete, frames and audio are stored in the\nnewly created `capture` folder.\n\nGenerate the video file `capture.mp4` by calling:\n\n```powershell\n.\\encode.ps1\n```\n\nTo see encoding options enter:\n\n```powershell\nGet-Help .\\encode.ps1\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrafpy%2F4k-intro-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrafpy%2F4k-intro-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrafpy%2F4k-intro-template/lists"}