From 0aff47c6d912273f2098f1cbb376de5720ca6224 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 19 Nov 2002 23:57:10 +0000 Subject: [PATCH] voom --- stepmania/src/ScreenSandbox.cpp | 86 +++------------------------------ stepmania/src/ScreenSandbox.h | 8 +-- 2 files changed, 8 insertions(+), 86 deletions(-) diff --git a/stepmania/src/ScreenSandbox.cpp b/stepmania/src/ScreenSandbox.cpp index 9667a1711d..b660259b54 100644 --- a/stepmania/src/ScreenSandbox.cpp +++ b/stepmania/src/ScreenSandbox.cpp @@ -33,82 +33,8 @@ ScreenSandbox::ScreenSandbox() { - rot = 0; - tX = 0; - tY = 0; - tZ = 0; -} - - -void ScreenSandbox::Update( float fDeltaTime ) -{ - rot += fDeltaTime * 360.f; - rot = float(fmod(rot, 360.f)); -} - -void ScreenSandbox::DrawPrimitives() -{ - DISPLAY->FlushQueue(); /* do this before rendering directly */ - - /* If this is a sub-object (3d object within a 3d object), this won't - * actually do anything: */ - DISPLAY->EnterPerspective(60); - - DISPLAY->SetTexture(NULL); - DISPLAY->EnableZBuffer(); - - glColor4f(1,1,1,1); - glPushMatrix(); - SetX(CENTER_X); - SetY(CENTER_Y); - - /* By default, 0,0,0 is the center of the object, at the location the actor - * is set to. We have to translate away from the viewpoint (negative Z) - * to get away from the viewer (and in front of the near clip plane). */ - glTranslatef (0,0,-5); - - { /* Standard ugly OpenGL lighting stuff. */ - GLfloat mat_ambient[] = { 1.0, 1.0, 1.0, 1.0 }; - GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; - GLfloat light_position[] = { 0.0, 0.0, 0.0, 1.0 }; - GLfloat lm_ambient[] = { 0.3f, 0.3f, 0.3f, 1.0f }; - - glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); - glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); - glMaterialf(GL_FRONT, GL_SHININESS, 100.0); - glLightfv(GL_LIGHT0, GL_POSITION, light_position); - glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lm_ambient); - - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - } - - GLfloat sphere_diffuse[] = { 0.7f, 0.0f, 0.7f, 1.0f }; - glMaterialfv(GL_FRONT, GL_DIFFUSE, sphere_diffuse); - GLUquadricObj *quadObj = gluNewQuadric(); - gluQuadricDrawStyle(quadObj, GLU_FILL); - gluQuadricNormals(quadObj, GLU_SMOOTH); - - glRotatef (rot, 0.0, 1.0, 0.0); - - glPushMatrix(); - glTranslatef (1,0,0); - gluSphere(quadObj, (tX+.25), (tY+8), (tZ+16)); - glPopMatrix(); - - glPushMatrix(); - glTranslatef (-1,0,0); - gluSphere(quadObj, (tX+.35), (tY+8), (tZ+16)); - glPopMatrix(); - - gluDeleteQuadric(quadObj); - glPopMatrix(); - - DISPLAY->ExitPerspective(); - DISPLAY->DisableZBuffer(); - - glDisable(GL_LIGHTING); - glDisable(GL_LIGHT0); + obj.SetXY(CENTER_X, CENTER_Y); + this->AddChild(&obj); } void ScreenSandbox::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) @@ -122,16 +48,16 @@ void ScreenSandbox::Input( const DeviceInput& DeviceI, const InputEventType type switch( DeviceI.button ) { case DIK_LEFT: - glTranslatef ((tX-.1),0,0); + obj.SetX(obj.GetX() - 10); break; case DIK_RIGHT: - glTranslatef ((tX+.1),0,0); + obj.SetX(obj.GetX() + 10); break; case DIK_UP: - glTranslatef (0,(tY-.1),0); + obj.SetY(obj.GetY() - 10); break; case DIK_DOWN: - glTranslatef (0,(tY+.1),0); + obj.SetY(obj.GetY() + 10); break; case DIK_T: { diff --git a/stepmania/src/ScreenSandbox.h b/stepmania/src/ScreenSandbox.h index 221700e1b5..0aa808c2cf 100644 --- a/stepmania/src/ScreenSandbox.h +++ b/stepmania/src/ScreenSandbox.h @@ -19,23 +19,19 @@ #include "MenuElements.h" #include "TipDisplay.h" #include "RageSoundStream.h" +#include "Sample3dObject.h" class ScreenSandbox : public Screen { - float rot; - float tX; - float tY; - float tZ; public: ScreenSandbox(); - virtual void Update( float fDeltaTime ); - virtual void DrawPrimitives(); virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); virtual void HandleScreenMessage( const ScreenMessage SM ); Sprite m_sprite; + Sample3dObject obj; };