Creating a project from scratch (Windows)

So you are on Windows, right? Let's create an empty project in Visual C++. We will link it to all the necessary libraries and make sure that it is possible to compile the project before we move on.

Go to your Cinder project directory (which in my case is C:Userskr15hDocumentsCinderProjects) and create a new directory BaseApp there.

Open Microsoft Visual C++ 2010 and go to File | New | Project. Choose Win32 Project from the Win32 category. Enter the name BaseApp in the Name field and your BaseApp project directory that we just created in the Location field. Make sure that the Create directory for solution checkbox is not checked and the solution name is BaseApp—the same as the name of the project.

In the Application Settings dialog, check the Empty project checkbox and make sure that you choose Windows application as the Application type. Click on Finish.

Close Visual C++ and go to the BaseApp project directory. You will see another directory with a name BaseApp inside it—rename it to vc10.

Create a new directory in the same level where the vc10 folder is and rename it to src. Open the BaseApp.sln file in the vc10 folder. Create a new C++ file. Choose File | New File. In the dialog box, choose the Visual C++ template category and select C++ File. Click on Open. A blank file will open in the editor. Enter the following piece of code there:

#include "cinder/app/AppBasic.h"
#include "cinder/gl/gl.h"

using namespace ci;
using namespace ci::app;
using namespace std;

class BaseApp : public AppBasic {
public:
  void setup();
  void update();
  void draw();
};

void BaseApp::setup(){}
void BaseApp::update(){}

void BaseApp::draw()
{
  // clear out the window with black
 gl::clear( Color( 0, 0, 0 ) );
}

CINDER_APP_BASIC( BaseApp, RendererGl )

Go to File | Save As, navigate to the BaseAppsrc directory, and save the file with the name BaseApp.cpp. To keep things organized, navigate to the BaseApp folder in the Explorer and click-and-drag it to the Source Files directory in the Visual C++ 2010 Solution Explorer.

You won't be able to compile and run it yet. There are some more things to do.

Go to Project | BaseApp Properties. Choose All Configurations in the Configurations select field.

Click on the C/C++ category in the left column and find the Additional Include Directories field in the right column. Add the following paths there:

  • C:cinderinclude
  • C:cinderoost

Click on Linker in the left column and edit value of the Additional Library Directories field. You have to enter the following two paths there:

  • C:cinderlib
  • C:cinderlibmsw

Click on OK. Now select the Debug configuration and click on Input under Linker in the left column of the Project Properties window. Add cinder_d.lib to the Additional Dependencies field and LIBCMT in the Ignore Specific Default Libraries field.

With that done, select the Release configuration and add cinder.lib to the Additional Dependencies field.

Click on OK. Build and run the application. A window with a black background should appear. If so, you are the master and we may continue with the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.223.190