You may use many of these code snippets in your own work, BUT you
may not copy anyone else's (including my) work and submit as your
own.
I will be extremely unhappy if I find that you are submitting
someone else's work as your own.
![]() |
outline: |
More links: |
// stdafx.h
// ND: mac and others:
#ifdef __APPLE__
#include <GLUT/glut.h>
#include <unistd.h>
// usleep (ms * 1000); // ND: measure ms in milli-seconds
#else
#include <GL/glut.h>
#endif
// in syntax.h
// ND: mac and others:
#ifdef __APPLE__
class SyntaxError: public runtime_error // ND: mac
{
public:
SyntaxError(string message) : runtime_error(message.c_str()) {} // ND: mac
};
#else
class SyntaxError: public exception
{
public:
SyntaxError(string message) : exception(message.c_str()) {}
};
#endif
// in scene.cpp
// ND: mac and others
#ifdef __APPLE__
for (auto graphic : graphics) // ND: mac version
#else
for each (auto graphic in graphics)
#endif
// in text.cpp p2
#ifdef __APPLE__
for (char ch : text) // ND: mac version
#else
for each (char ch in text)
#endif
// in scene.cpp p2
#ifdef __APPLE__
for (auto graphic : graphics) // ND: mac version
#else
for each (auto graphic in graphics)
#endif
// in hollowpolygon.cpp p2
#ifdef __APPLE__
for (auto transformation : transformations) // ND: mac version
#else
for each (auto transformation in transformations)
#endif
// in convexpolygon.cpp p2
#ifdef __APPLE__
for (auto transformation : transformations) // ND: mac version
#else
for each (auto transformation in transformations)
#endif
// sleep fails, so:
#ifdef __APPLE__
// #include <unistd.h>
usleep (ms * 1000); // ND: measure ms in milli-seconds
#else
sleep (ms);
#endif
The code needed on a Mac to implement this call:
#include
<string.h>
void * font = GLUT_BITMAP_8_BY_13;