Skip to content

Getting Started on Mac

RUSshy edited this page Mar 17, 2017 · 1 revision

Getting Started

This is a simple guide for setting up nuklear on a Mac. We will be using the GLFW3-OpenGL backend.

Downloading Libraries

Assuming you already have a C compiler downloaded, the only other libraries we will need are GLFW3 and GLEW. We will also be using git to clone nuklear into a new folder.

To install these you will need a package manager such as Homebrew or Macports. We will be using Homebrew. Instructions for installing Homebrew are available at http://brew.sh/.

Now that you have Homebrew installed, open a new terminal window. Enter the following commands:

$ brew install glfw3

$ brew install glew

If you don't have git installed also enter:

$ brew install git

Now that all of our dependencies are installed, we can start working with nuklear.

Downloading Nuklear

Open a new terminal window and make sure that you are in the root of your user folder. You can enter $ cd to be sure. To clone Nuklear, type the following:

$ git clone https://github.com/vurtun/nuklear.git

Now type:

$ open nuklear

You should be greeted with a Finder window similar to this:

Go into the demo folder, then open the "glfw_opengl3" folder. It should look like this:

Copy all the files from there into main nuklear directory, and then delete the demo folder. It should now look like this:

Hooray! We are done downloading Nuklear. Now for the fun part...

Building

We are almost ready to build, but there is one more thing we must do.

Open up main.c in your favorite text editor. You will be met with what looks like the inclusion of 50 header files. Scroll down until you see #include "../../nuklear.h" It should be around line 25.

Now, get rid of the ../.../ part. It should now look like this:

Save the file and close it. We are ready to build.

Open a new terminal. Once again, make sure you are in your use root. Now type $ cd nuklear so that you are in the nuklear folder. Now type $ make.

It may spout out a few warnings, but that is alright. As long as there are no errors we are fine. If there are errors, look back and make sure you followed this guide correctly and have all of your libraries installed.

Now open the nuklear folder in Finder. There should be a new folder called bin. Open it. Inside there will be an executable called "demo". Double-click it.

If all was done correctly, you should have a window open like this:

Congratulations! You have just ran your first app with nuklear! You can play around with the dials and see what happens. Once you are done feel free to quit out of it and all terminal windows.

Conclusion

Once you have finished, feel free to experiment inside of the main.c file and try to see if you can change the look of the window and the widget inside of it. Just make sure you have a copy somewhere to revert to if you mess something up.