From 94d110edd56a4d2b871871bfe226c119d6f35d43 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Tue, 29 Oct 2024 21:19:28 +0000 Subject: [PATCH] Specify C source file in example VC projects --- .../01-simple-playback/01-simple-playback.vcxproj | 2 +- .../02-simple-playback-callback.vcxproj | 2 +- .../examples/audio/03-load-wav/03-load-wav.vcxproj | 2 +- .../01-read-and-draw/01-read-and-draw.vcxproj | 2 +- VisualC/examples/game/01-snake/01-snake.vcxproj | 2 +- .../game/02-woodeneye-008/02-woodeneye-008.vcxproj | 2 +- .../03-infinite-monkeys.vcxproj | 2 +- VisualC/examples/generate.py | 14 +++++++++++--- .../pen/01-drawing-lines/01-drawing-lines.vcxproj | 2 +- .../examples/renderer/01-clear/01-clear.vcxproj | 2 +- .../renderer/02-primitives/02-primitives.vcxproj | 2 +- .../examples/renderer/03-lines/03-lines.vcxproj | 2 +- .../examples/renderer/04-points/04-points.vcxproj | 2 +- .../renderer/05-rectangles/05-rectangles.vcxproj | 2 +- .../renderer/06-textures/06-textures.vcxproj | 2 +- .../07-streaming-textures.vcxproj | 2 +- .../08-rotating-textures.vcxproj | 2 +- .../09-scaling-textures.vcxproj | 2 +- .../renderer/10-geometry/10-geometry.vcxproj | 2 +- .../renderer/11-color-mods/11-color-mods.vcxproj | 2 +- .../renderer/14-viewport/14-viewport.vcxproj | 2 +- .../renderer/15-cliprect/15-cliprect.vcxproj | 2 +- .../renderer/17-read-pixels/17-read-pixels.vcxproj | 2 +- .../renderer/18-debug-text/18-debug-text.vcxproj | 2 +- 24 files changed, 34 insertions(+), 26 deletions(-) diff --git a/VisualC/examples/audio/01-simple-playback/01-simple-playback.vcxproj b/VisualC/examples/audio/01-simple-playback/01-simple-playback.vcxproj index cf428b127..de4a67cee 100644 --- a/VisualC/examples/audio/01-simple-playback/01-simple-playback.vcxproj +++ b/VisualC/examples/audio/01-simple-playback/01-simple-playback.vcxproj @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/VisualC/examples/audio/02-simple-playback-callback/02-simple-playback-callback.vcxproj b/VisualC/examples/audio/02-simple-playback-callback/02-simple-playback-callback.vcxproj index e1e19126f..7140c331e 100644 --- a/VisualC/examples/audio/02-simple-playback-callback/02-simple-playback-callback.vcxproj +++ b/VisualC/examples/audio/02-simple-playback-callback/02-simple-playback-callback.vcxproj @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/VisualC/examples/audio/03-load-wav/03-load-wav.vcxproj b/VisualC/examples/audio/03-load-wav/03-load-wav.vcxproj index 8da33130a..356cb6e2f 100644 --- a/VisualC/examples/audio/03-load-wav/03-load-wav.vcxproj +++ b/VisualC/examples/audio/03-load-wav/03-load-wav.vcxproj @@ -7,7 +7,7 @@ - + diff --git a/VisualC/examples/camera/01-read-and-draw/01-read-and-draw.vcxproj b/VisualC/examples/camera/01-read-and-draw/01-read-and-draw.vcxproj index 5dcbfef4c..c143bcec5 100644 --- a/VisualC/examples/camera/01-read-and-draw/01-read-and-draw.vcxproj +++ b/VisualC/examples/camera/01-read-and-draw/01-read-and-draw.vcxproj @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/VisualC/examples/game/01-snake/01-snake.vcxproj b/VisualC/examples/game/01-snake/01-snake.vcxproj index c83c670fe..d9c0d862d 100644 --- a/VisualC/examples/game/01-snake/01-snake.vcxproj +++ b/VisualC/examples/game/01-snake/01-snake.vcxproj @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/VisualC/examples/game/02-woodeneye-008/02-woodeneye-008.vcxproj b/VisualC/examples/game/02-woodeneye-008/02-woodeneye-008.vcxproj index 5bf3df2a0..da8931261 100644 --- a/VisualC/examples/game/02-woodeneye-008/02-woodeneye-008.vcxproj +++ b/VisualC/examples/game/02-woodeneye-008/02-woodeneye-008.vcxproj @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/VisualC/examples/game/03-infinite-monkeys/03-infinite-monkeys.vcxproj b/VisualC/examples/game/03-infinite-monkeys/03-infinite-monkeys.vcxproj index 9535db263..58e3c8177 100644 --- a/VisualC/examples/game/03-infinite-monkeys/03-infinite-monkeys.vcxproj +++ b/VisualC/examples/game/03-infinite-monkeys/03-infinite-monkeys.vcxproj @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/VisualC/examples/generate.py b/VisualC/examples/generate.py index 85b249121..e06110e4b 100644 --- a/VisualC/examples/generate.py +++ b/VisualC/examples/generate.py @@ -4,7 +4,8 @@ import uuid REPOSITORY_ROOT = pathlib.Path(__file__).parent.parent.parent -def generate(category, example_name): + +def generate(category, example_name, c_source_file): guid = str(uuid.uuid4()).upper() text = f""" @@ -16,7 +17,7 @@ def generate(category, example_name): - + @@ -34,12 +35,19 @@ def generate(category, example_name): f.write(text) +def get_c_source_filename(example_dir: pathlib.Path): + """Gets the one and only C source file name in the directory of the example.""" + c_files = [f.name for f in example_dir.iterdir() if f.name.endswith(".c")] + assert len(c_files) == 1 + return c_files[0] + + def main(): path = REPOSITORY_ROOT / "examples" for category in path.iterdir(): if category.is_dir(): for example in category.iterdir(): - generate(category.name, example.name) + generate(category.name, example.name, get_c_source_filename(example)) if __name__ == "__main__": diff --git a/VisualC/examples/pen/01-drawing-lines/01-drawing-lines.vcxproj b/VisualC/examples/pen/01-drawing-lines/01-drawing-lines.vcxproj index 9174268e8..64025bb77 100644 --- a/VisualC/examples/pen/01-drawing-lines/01-drawing-lines.vcxproj +++ b/VisualC/examples/pen/01-drawing-lines/01-drawing-lines.vcxproj @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/VisualC/examples/renderer/01-clear/01-clear.vcxproj b/VisualC/examples/renderer/01-clear/01-clear.vcxproj index 562f7f358..e55d8df35 100644 --- a/VisualC/examples/renderer/01-clear/01-clear.vcxproj +++ b/VisualC/examples/renderer/01-clear/01-clear.vcxproj @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/VisualC/examples/renderer/02-primitives/02-primitives.vcxproj b/VisualC/examples/renderer/02-primitives/02-primitives.vcxproj index d4ed14ba5..525bba761 100644 --- a/VisualC/examples/renderer/02-primitives/02-primitives.vcxproj +++ b/VisualC/examples/renderer/02-primitives/02-primitives.vcxproj @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/VisualC/examples/renderer/03-lines/03-lines.vcxproj b/VisualC/examples/renderer/03-lines/03-lines.vcxproj index 01a7809d4..4b40b7e28 100644 --- a/VisualC/examples/renderer/03-lines/03-lines.vcxproj +++ b/VisualC/examples/renderer/03-lines/03-lines.vcxproj @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/VisualC/examples/renderer/04-points/04-points.vcxproj b/VisualC/examples/renderer/04-points/04-points.vcxproj index 0796dfdef..0c8fa22f5 100644 --- a/VisualC/examples/renderer/04-points/04-points.vcxproj +++ b/VisualC/examples/renderer/04-points/04-points.vcxproj @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/VisualC/examples/renderer/05-rectangles/05-rectangles.vcxproj b/VisualC/examples/renderer/05-rectangles/05-rectangles.vcxproj index d9f6d795e..8d4b33b5c 100644 --- a/VisualC/examples/renderer/05-rectangles/05-rectangles.vcxproj +++ b/VisualC/examples/renderer/05-rectangles/05-rectangles.vcxproj @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/VisualC/examples/renderer/06-textures/06-textures.vcxproj b/VisualC/examples/renderer/06-textures/06-textures.vcxproj index 8c6595111..d99b62c06 100644 --- a/VisualC/examples/renderer/06-textures/06-textures.vcxproj +++ b/VisualC/examples/renderer/06-textures/06-textures.vcxproj @@ -7,7 +7,7 @@ - + diff --git a/VisualC/examples/renderer/07-streaming-textures/07-streaming-textures.vcxproj b/VisualC/examples/renderer/07-streaming-textures/07-streaming-textures.vcxproj index 6affa1cd1..0830c4fbb 100644 --- a/VisualC/examples/renderer/07-streaming-textures/07-streaming-textures.vcxproj +++ b/VisualC/examples/renderer/07-streaming-textures/07-streaming-textures.vcxproj @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/VisualC/examples/renderer/08-rotating-textures/08-rotating-textures.vcxproj b/VisualC/examples/renderer/08-rotating-textures/08-rotating-textures.vcxproj index 90833c64a..5e14c6d09 100644 --- a/VisualC/examples/renderer/08-rotating-textures/08-rotating-textures.vcxproj +++ b/VisualC/examples/renderer/08-rotating-textures/08-rotating-textures.vcxproj @@ -7,7 +7,7 @@ - + diff --git a/VisualC/examples/renderer/09-scaling-textures/09-scaling-textures.vcxproj b/VisualC/examples/renderer/09-scaling-textures/09-scaling-textures.vcxproj index 4d97ffc79..ada32f700 100644 --- a/VisualC/examples/renderer/09-scaling-textures/09-scaling-textures.vcxproj +++ b/VisualC/examples/renderer/09-scaling-textures/09-scaling-textures.vcxproj @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/VisualC/examples/renderer/10-geometry/10-geometry.vcxproj b/VisualC/examples/renderer/10-geometry/10-geometry.vcxproj index f551958a3..6013514fe 100644 --- a/VisualC/examples/renderer/10-geometry/10-geometry.vcxproj +++ b/VisualC/examples/renderer/10-geometry/10-geometry.vcxproj @@ -7,7 +7,7 @@ - + diff --git a/VisualC/examples/renderer/11-color-mods/11-color-mods.vcxproj b/VisualC/examples/renderer/11-color-mods/11-color-mods.vcxproj index 766f6550c..c0af3e32d 100644 --- a/VisualC/examples/renderer/11-color-mods/11-color-mods.vcxproj +++ b/VisualC/examples/renderer/11-color-mods/11-color-mods.vcxproj @@ -7,7 +7,7 @@ - + diff --git a/VisualC/examples/renderer/14-viewport/14-viewport.vcxproj b/VisualC/examples/renderer/14-viewport/14-viewport.vcxproj index c15c28075..1ebbda55f 100644 --- a/VisualC/examples/renderer/14-viewport/14-viewport.vcxproj +++ b/VisualC/examples/renderer/14-viewport/14-viewport.vcxproj @@ -7,7 +7,7 @@ - + diff --git a/VisualC/examples/renderer/15-cliprect/15-cliprect.vcxproj b/VisualC/examples/renderer/15-cliprect/15-cliprect.vcxproj index 6f8ce5f52..dbb7ca670 100644 --- a/VisualC/examples/renderer/15-cliprect/15-cliprect.vcxproj +++ b/VisualC/examples/renderer/15-cliprect/15-cliprect.vcxproj @@ -7,7 +7,7 @@ - + diff --git a/VisualC/examples/renderer/17-read-pixels/17-read-pixels.vcxproj b/VisualC/examples/renderer/17-read-pixels/17-read-pixels.vcxproj index 60b599e1c..674462e8e 100644 --- a/VisualC/examples/renderer/17-read-pixels/17-read-pixels.vcxproj +++ b/VisualC/examples/renderer/17-read-pixels/17-read-pixels.vcxproj @@ -7,7 +7,7 @@ - + diff --git a/VisualC/examples/renderer/18-debug-text/18-debug-text.vcxproj b/VisualC/examples/renderer/18-debug-text/18-debug-text.vcxproj index 05c964d4d..98f11985e 100644 --- a/VisualC/examples/renderer/18-debug-text/18-debug-text.vcxproj +++ b/VisualC/examples/renderer/18-debug-text/18-debug-text.vcxproj @@ -7,7 +7,7 @@ - + \ No newline at end of file