// Genesaver: copyright 2003 Sam Stafford. #include <GL/glut.h> #include "globals.h" #include "Thing.h" Thing::Thing(void) { } Thing::~Thing(void) { } void Thing::RenderBy( float ax, float ay ) { // Wrap around world edge. float tx = x; float ty = y; x = XNearest( ax ); y = YNearest( ay ); bool vis = (x - ax)*(x - ax) + (y - ay)*(y - ay) <= A_V*A_V; if ( !vis && settings.drawvis ) { x = tx; y = ty; return; } if ( !vis ) fsettings.alpha = 0.2; glMatrixMode( GL_MODELVIEW ); glPushMatrix(); glTranslatef( 0, 0.5, 0 ); //move to top of screen glScalef( 0.5 / A_V, 0.5 / A_V, 0.5 / A_V ); //scale to vis range glTranslatef( -ax, -ay, 0 ); //center on target creature Render(); glPopMatrix(); x = tx; y = ty; fsettings.alpha = 1.0; return; } float Thing::XNearest( float ax ) { if ( ax > x ) { if ( ax - x > 1.0 ) return x + 2.0; else return x; } else { if ( x - ax > 1.0 ) return x - 2.0; else return x; } } float Thing::YNearest( float ay ) { if ( ay > y ) { if ( ay - y > 1.0 ) return y + 2.0; else return y; } else { if ( y - ay > 1.0 ) return y - 2.0; else return y; } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 5393 | Sam Stafford |
Integrate in Marc's porting changes, and merge my own relevant winmain.cpp changes into main.cpp. (Thanks Marc!!!) |
||
#2 | 5366 | Sam Stafford |
A bit of infrastructure tidying and a minor performance enhancement - the genome is now not saved when running in "demo mode" in Windows, which eliminates that little pause when you close the Windows display dialog after modifying Genesaver settings. |
||
#1 | 3052 | Sam Stafford |
Add Genesaver to the Public Depot. It's not in any way Perforce-related, but it does share a bit of code with Jamgraph, and it feels strange to have an open-source project that's not in the PD. |