This was just me fooling around how to figure out practical applications of "Sin" and "Cos" (other then for my math teachers use it as tools of torture).
What happens is that a Blue wave goes up the screen, then bounces back as a green wave, then repeats forever. Add a "dbSetDisplayMode(WINDOW WIDTH, WINDOW HEIGHT, COLOR DEPTH);" if you use a larger screen, and it will still be 20 lines or under.
#include "DarkGDK.h"
void DarkGDK() {
dbSyncOn();
int x = 0;
int y = dbScreenHeight();
bool yDirection = 1;
int pan;
dbInk(dbRGB(0, 0, 255), 0);
while (LoopGDK()) {
pan = (dbSin(x) * 100) + (dbScreenWidth() / 2);
dbDot(pan, y - 1);
x++;
if (yDirection == 1) {y -= 1; dbInk(dbRGB(0, 0, 255), 0); }
else if (yDirection == 0) {y += 1; dbInk(dbRGB(0, 255, 0), 0); }
if (y < 0) yDirection = 0;
else if (y > dbScreenHeight()) yDirection = 1;
dbSync();
}
}
Screenshot:
http://twewy-fan.com/ <-- The first ever fansite for "The World Ends With You"