Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4e95667
Add "unstable" release to develop branch
Jack-Punter Jan 14, 2026
b886fca
Reapply "Added API to specify vertex parameters for rectangle corners."
Jack-Punter Jan 14, 2026
d920b47
Reapply "Fixed cast in 4ed_api_parser_main.cpp, updated custom/genera…
Jack-Punter Jan 14, 2026
1ee2f8e
Remove tier system in 4ed_build.cpp
saccarosium Jan 6, 2026
38007bc
Merge package functions in one
saccarosium Jan 6, 2026
9e1220d
Put all artifacts in build directory
saccarosium Jan 6, 2026
2711ed9
Refactor 4ed_build
saccarosium Jan 6, 2026
ee0f6c9
Update build instructions
saccarosium Jan 6, 2026
5642988
Use already present context macros
saccarosium Jan 6, 2026
51dbf73
Update github actions
saccarosium Jan 6, 2026
dce4596
Update build instructions
saccarosium Jan 7, 2026
b32ae0c
Pass optimization options to custom_layer build script
saccarosium Jan 9, 2026
b6b9832
update project to include its format options, fix shipped config file
B-Y-P Jan 13, 2026
68354c4
fix goto_next_jump accounts for .cursor_at_end
B-Y-P Jan 13, 2026
afb13d7
fix redo off-by-1
B-Y-P Jan 13, 2026
4f32f98
added word_complete_prev command
B-Y-P Jan 14, 2026
d472842
search lists now jumpable
B-Y-P Jan 14, 2026
8e521a8
Add develop branch to pull request workflow
Jack-Punter Feb 24, 2026
ea98e77
Mark "unstable" as a prerelease and update the releases so the source…
Jack-Punter Feb 26, 2026
904302e
CI update 2 to fix zip files
Jack-Punter Feb 26, 2026
402ba73
Update CODEOWNERS to change organization reference
Jack-Punter Feb 27, 2026
3358c50
Build freetype locally
longtran2904 Aug 24, 2025
f69e0b9
Add x86 support to `build_freetype.bat`
longtran2904 Aug 25, 2025
a0e393a
Add build script for Linux and Mac
longtran2904 Mar 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @org/Maintainers
* @4coder-community/maintainers
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ jobs:
include:
- suffix: x64-win-dx11
os: windows-latest
build_cmd: bin\package.bat /DWIN32_DX11
build_cmd: bin\build.bat /DWIN32_DX11
- suffix: x64-win-gl
os: windows-latest
build_cmd: bin\package.bat /DWIN32_OPENGL
build_cmd: bin\build.bat /DWIN32_OPENGL
- suffix: x64-linux
os: ubuntu-latest
build_cmd: sudo apt update -y && sudo apt install build-essential libx11-dev libxfixes-dev libglx-dev mesa-common-dev libasound2-dev libfreetype-dev libfontconfig-dev -y && ./bin/package-linux.sh
build_cmd: sudo apt update -y && sudo apt install build-essential libx11-dev libxfixes-dev libglx-dev mesa-common-dev libasound2-dev libfreetype-dev libfontconfig-dev -y && ./bin/build-linux.sh
- suffix: x64-mac
os: macos-15-intel
build_cmd: ./bin/package-mac.sh
# - suffix: arm64-mac
# os: macos-latest
# build_cmd: ./bin/package_arm64-mac.sh
build_cmd: ./bin/build-mac.sh
# - suffix: arm64-mac
# os: macos-latest
# build_cmd: arch -arch x86_64 ./bin/build-mac.sh
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -34,5 +34,5 @@ jobs:
uses: actions/upload-artifact@v4.6.0
with:
name: 4cc-${{ matrix.suffix }}
path: current_dist_super_x64/4coder/ # having "x64" in path might have to change
path: build/

1 change: 1 addition & 0 deletions .github/workflows/pr_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
branches:
- master
- develop

jobs:
build_4cc:
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/update_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- develop
tags:
- v*

Expand All @@ -12,22 +13,27 @@ jobs:
uses: ./.github/workflows/build.yml

publish_release:
if: github.ref_type == 'tag' || github.ref == 'refs/heads/master'
if: github.ref_type == 'tag' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop'
needs: build_4cc
name: Upload Release
runs-on: ubuntu-latest
permissions:
contents: write
env:
GH_TOKEN: ${{ github.token }}
RELEASE_NAME: ${{ github.ref_type == 'tag' && github.ref_name || 'latest' }}
RELEASE_TITLE: ${{ github.ref_type == 'tag' && github.ref_name || 'Latest' }}
RELEASE_NAME: ${{ github.ref_type == 'tag' && github.ref_name || github.ref == 'refs/heads/develop' && 'unstable' || 'latest' }}
RELEASE_TITLE: ${{ github.ref_type == 'tag' && github.ref_name || github.ref == 'refs/heads/develop' && 'Unstable' || 'Latest' }}
RELEASE_TARGET: ${{ github.sha }}
RELEASE_PRERELEASE_FLAG: ${{ github.ref == 'refs/heads/develop' && '--prerelease' || '' }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Create Release Exists
run: |
if ! gh release view "$RELEASE_NAME" --repo "${{ github.repository }}"; then
gh release create "$RELEASE_NAME" --repo "${{ github.repository }}" --title "$RELEASE_TITLE" --notes " "
gh release create "$RELEASE_NAME" --repo "${{ github.repository }}" --title "$RELEASE_TITLE" --target "$RELEASE_TARGET" $RELEASE_PRERELEASE_FLAG --notes " "
fi

- name: Download 4cc Artifacts
Expand All @@ -42,3 +48,9 @@ jobs:

- name: Upload to Release
run: gh release upload "$RELEASE_NAME" artifacts_dir/4cc-*.zip --repo "${{ github.repository }}" --clobber

- name: Update Rolling Release Tag
if: github.ref_type != 'tag'
run: |
git tag -f "$RELEASE_NAME" "$RELEASE_TARGET"
git push --force origin "refs/tags/$RELEASE_NAME"
60 changes: 30 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,50 @@
# Building

## Windows
1. Setup the MSVC toolchain in your environment, this can be done with the `code/custom/bin/setup_cl_x64.bat` script
2. call the `package.bat` script from the code directory (this builds a distribution in the `distributions` directory with all the non-binary dependencies)
1. `$ cd 4cc\code`
2. `.\bin\package.bat`
3. You can also use the `build.bat` script if you want just build the binaries (this produces the build artifacts in the `build` directory, this doesn't produce a functional distribution)
1. `$ cd 4cc\code`
2. `$ .\bin\build.bat`

> [!NOTE]
> 4coder needs the MSVC compiler and windows SDK from the "Desktop development with C++" component. If you don’t have this already, you can download the installer [here](https://visualstudio.microsoft.com/downloads/). Make sure to at least click on "Desktop development with C++" and tick the boxes for MSVC and the Windows SDK.

1. Setup the MSVC toolchain in your environment, this can be done either with the `code/custom/bin/setup_cl_x64.bat` script or by using the development shell in windows terminal
2. Execute this command from the root of the project (the resulting executable will be under the `build` folder in the root of the repo)

```batch
cd code && .\bin\build.bat
```

In addition to the parameter listed below, you can specify which backend to use by passing one of those parameters to the build scripts:
- `/DWIN32_OPENGL` (default) to use the OpenGL backend.
- `/DWIN32_DX11` to use the Direct3D 11 backend.

```batch
cd code && .\bin\build.bat /DWIN32_DX11
```

## Linux

> tested on Ubuntu 22.04:

1. Get required libraries (apt names):
- `$ sudo apt install build-essential libx11-dev libxfixes-dev libglx-dev mesa-common-dev libasound2-dev libfreetype-dev libfontconfig-dev`
2. Use the `package-linux.sh` script from the code directory (this builds a distribution in the `distributions` directory with all the non-binary dependencies)
1. `$ cd 4cc/code`
2. `$ ./bin/package-linux.sh`

3. You can also use the `build-linux.sh` script if you want just build the binaries, (this produces the build artifacts in the `build` directory, this doesn't produce a functional distribution)
1. `$ cd 4cc/code`
2. `$ ./bin/build-linux.sh`
```sh
sudo apt install build-essential libx11-dev libxfixes-dev libglx-dev mesa-common-dev libasound2-dev libfreetype-dev libfontconfig-dev`
```

2. Execute this command from the root of the project (the resulting executable will be under the `build` folder in the root of the repo)

```sh
cd code && ./bin/build-linux.sh
```

## Mac

> 4coder targets x86_64. If you are using a M1+ ARM CPU you need to prefix the build scripts commands with: `arch -arch x86_64`

1. Use the `package-mac.sh` script from the code directory (this builds a distribution in the `distributions` directory with all the non-binary dependencies)
1. `$ cd 4cc/code`
2. `$ ./bin/package-mac.sh`
1. Execute this command from the root of the project (the resulting executable will be under the `build` folder in the root of the repo)

2. You can also use the `build-mac.sh` script if you want just build the binaries, (this produces the build artifacts in the `build` directory, this doesn't produce a functional distribution)
1. `$ cd 4cc/code`
2. `$ ./bin/build-mac.sh`
```sh
cd code && ./bin/build-mac.sh
```

### Older Macs, 10.15.7 Catalina

Expand All @@ -51,20 +59,12 @@ If you are using an older version of mac, such as 10.15.7 Catalina you need to i
## Build script parameter

The build script accepts a parameter (mutually exclusive):
- `/DDEV_BUILD` or `/DDEV_BUILD_X86` (default value) : build without optimizations.
- `/DDEV_BUILD` (default value) : build without optimizations.
Produces debug symbols.
Defines: `FRED_INTERNAL`, `FRED_SUPER`, `DO_CRAZY_EXPENSIVE_ASSERTS` (on Windows) macros.
- `/DOPT_BUILD` or `/DOPT_BUILD_X86` (similar to `build_optimized` script): build with optimizations.
- `/DOPT_BUILD` (similar to `build_optimized` script): build with optimizations.
Doesn't produce debug symbols.
Defines `FRED_SUPER` macro.
- `/DPACKAGE_SUPER_X64` or `/DPACKAGE_SUPER_X86` (similar to `package` script): package 4coder for distribution.
Turns on optimizations.
Produces debug symbols.
Defines `SHIP_MODE`, `FRED_SUPER`, `DO_CRAZY_EXPENSIVE_ASSERTS` (on Windows) macros.
- `/DPACKAGE_DEMO_X64` or `/DPACKAGE_DEMO_X86`: packages 4coder demo for distribution.
Turns on optimizations.
Produces debug symbols.
Defines `SHIP_MODE`, `DO_CRAZY_EXPENSIVE_ASSERTS` (on Windows) macros.

## API generators

Expand Down
26 changes: 26 additions & 0 deletions code/4ed_api_implementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2898,6 +2898,32 @@ draw_rectangle_outline(Application_Links *app, Rect_f32 rect, f32 roundness, f32
}
}

api(custom) function void
draw_rectangle_outline_corner_parameters(Application_Links *app, Rect_f32 rect,
f32 roundness_x0y0, f32 roundness_x1y0, f32 roundness_x0y1, f32 roundness_x1y1,
f32 thickness_x0y0, f32 thickness_x1y0, f32 thickness_x0y1, f32 thickness_x1y1,
u32 color_x0y0, u32 color_x1y0, u32 color_x0y1, u32 color_x1y1){
Models *models = (Models*)app->cmd_context;
if (models->in_render_mode){
draw_rectangle_outline_corner_parameters(models->target, rect,
roundness_x0y0, roundness_x1y0, roundness_x0y1, roundness_x1y1,
thickness_x0y0, thickness_x1y0, thickness_x0y1, thickness_x1y1,
color_x0y0, color_x1y0, color_x0y1, color_x1y1);
}
}

api(custom) function void
draw_rectangle_corner_parameters(Application_Links *app, Rect_f32 rect,
f32 roundness_x0y0, f32 roundness_x1y0, f32 roundness_x0y1, f32 roundness_x1y1,
u32 color_x0y0, u32 color_x1y0, u32 color_x0y1, u32 color_x1y1){
Models *models = (Models*)app->cmd_context;
if (models->in_render_mode){
draw_rectangle_corner_parameters(models->target, rect,
roundness_x0y0, roundness_x1y0, roundness_x0y1, roundness_x1y1,
color_x0y0, color_x1y0, color_x0y1, color_x1y1);
}
}

api(custom) function Rect_f32
draw_set_clip(Application_Links *app, Rect_f32 new_clip){
Models *models = (Models*)app->cmd_context;
Expand Down
2 changes: 1 addition & 1 deletion code/4ed_api_parser_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ main(int argc, char **argv){
}

String_Const_u8 exe = SCu8("code/4ed_api_parser_main.exe");
u32 command_line_length = exe.size;
u64 command_line_length = exe.size;

for (i32 i = 1; i < argc; i+=1){
command_line_length += 1 + cstring_length(argv[i]);
Expand Down
59 changes: 58 additions & 1 deletion code/4ed_render_target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,68 @@ end_render_section(Render_Target *target){

////////////////////////////////

internal void
draw_rectangle_outline_corner_parameters(Render_Target *target, Rect_f32 rect,
f32 roundness_x0y0, f32 roundness_x1y0, f32 roundness_x0y1, f32 roundness_x1y1,
f32 thickness_x0y0, f32 thickness_x1y0, f32 thickness_x0y1, f32 thickness_x1y1,
u32 color_x0y0, u32 color_x1y0, u32 color_x0y1, u32 color_x1y1){

if ( rect_overlap(rect, target->current_clip_box) ) {

if (roundness_x0y0 < epsilon_f32) roundness_x0y0 = 0.f;
if (roundness_x1y0 < epsilon_f32) roundness_x1y0 = 0.f;
if (roundness_x0y1 < epsilon_f32) roundness_x0y1 = 0.f;
if (roundness_x1y1 < epsilon_f32) roundness_x1y1 = 0.f;

thickness_x0y0 = clamp_bot(1.f, thickness_x0y0);
thickness_x1y0 = clamp_bot(1.f, thickness_x1y0);
thickness_x0y1 = clamp_bot(1.f, thickness_x0y1);
thickness_x1y1 = clamp_bot(1.f, thickness_x1y1);

Render_Vertex vertices[6] = {};
vertices[0].xy = V2f32(rect.x0, rect.y0);
vertices[1].xy = vertices[3].xy = V2f32(rect.x1, rect.y0);
vertices[2].xy = vertices[4].xy = V2f32(rect.x0, rect.y1);
vertices[5].xy = V2f32(rect.x1, rect.y1);

vertices[0].color = color_x0y0;
vertices[1].color = vertices[3].color = color_x1y0;
vertices[2].color = vertices[4].color = color_x0y1;
vertices[5].color = color_x1y1;

vertices[0].half_thickness = thickness_x0y0/2.f;
vertices[1].half_thickness = vertices[3].half_thickness = thickness_x1y0/2.f;
vertices[2].half_thickness = vertices[4].half_thickness = thickness_x0y1/2.f;
vertices[5].half_thickness = thickness_x1y1/2.f;

Vec2_f32 center = rect_center(rect);

vertices[0].uvw = V3f32(center.x, center.y, roundness_x0y0);
vertices[1].uvw = vertices[3].uvw = V3f32(center.x, center.y, roundness_x1y0);
vertices[2].uvw = vertices[4].uvw = V3f32(center.x, center.y, roundness_x0y1);
vertices[5].uvw = V3f32(center.x, center.y, roundness_x1y1);

draw__write_vertices_in_current_group(target, vertices, ArrayCount(vertices));
}
}

internal void
draw_rectangle_corner_parameters(Render_Target *target, Rect_f32 rect,
f32 roundness_x0y0, f32 roundness_x1y0, f32 roundness_x0y1, f32 roundness_x1y1,
u32 color_x0y0, u32 color_x1y0, u32 color_x0y1, u32 color_x1y1){
Vec2_f32 dim = rect_dim(rect);
f32 thickness = Max(dim.x, dim.y);
draw_rectangle_outline_corner_parameters(target, rect,
roundness_x0y0, roundness_x1y0, roundness_x0y1, roundness_x1y1,
thickness, thickness, thickness, thickness,
color_x0y0, color_x1y0, color_x0y1, color_x1y1);
}

internal void
draw_rectangle_outline(Render_Target *target, Rect_f32 rect, f32 roundness, f32 thickness, u32 color){

if ( rect_overlap(rect, target->current_clip_box) ) {

if (roundness < epsilon_f32){
roundness = 0.f;
}
Expand Down
Loading
Loading