Skip to content

alcides-schulz/NatureOfCode_CPP_SDL

Repository files navigation

Nature of Code using C++/SDL

This project aims to reimplement the interactive examples from Daniel Shiffman's renowned book, The Nature of Code by Daniel Shiffman, published by No Starch Press® Inc., using the C++ programming language and the Simple DirectMedia Layer (SDL) library.

The primary goal is to deepen my understanding of both C++ and the SDL p5sdl through practical application. 'The Nature of Code' serves as an excellent resource, providing clear explanations of fundamental concepts in computational physics, simulation, and generative art, along with well-structured code examples. By translating these examples into C++/SDL, I aim to solidify my grasp of these principles and gain hands-on experience in low-level graphics and event handling.

To facilitate this process, I have developed a lightweight wrapper for Processing's P5.js within the C++/SDL environment. This wrapper provides a subset of the core P5.js functionalities, enabling a more direct porting of the book's examples without the overhead of a full P5.js emulation. It's important to note that the intention is not to create a complete P5.js clone, but rather a focused toolset tailored to the book's specific needs.

Through this project, I have gained valuable insights into the intricacies of C++ programming, the SDL library's capabilities, and the fascinating concepts presented in 'The Nature of Code.' The process has been both challenging and rewarding, fostering a deeper appreciation for the principles of creative coding and the power of low-level programming.

Running the Code

This project was developed using Visual Studio C++ in Windows. In order to run, download and install SDL. Compile the app and run the application, it is going to show a menu with all available chapters and examples.

Compiled SDL version 2.28.0
Linked SDL version 2.28.0

Nature of Code Menu

         a. Chapter 1 - Vectors
         b. Chapter 2 - Forces
         c. Chapter 3 - Oscillation
         d. Chapter 4 - Particle System
         e. Chapter 5 - Autonomous Agents
         f. Chapter 7 - Cellular Automata
         g. Chapter 8 - Fractals
         h. Chapter 9 - Evolutionary Computing

         z. Miscellaneous (development and test code)
         x. Exit

-->

License

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.

Also please see the book license page at https://natureofcode.com/credits/

About

Nature of Code Examples in C++/SDL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages