New Sandbox Stuff
This commit is contained in:
@@ -18,9 +18,12 @@
|
|||||||
Sample3dObject::Sample3dObject()
|
Sample3dObject::Sample3dObject()
|
||||||
{
|
{
|
||||||
rot = 0;
|
rot = 0;
|
||||||
|
Sample3dObject::Update();
|
||||||
|
DrawPrimitives();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sample3dObject::Update( float fDeltaTime )
|
void Sample3dObject::Update()
|
||||||
{
|
{
|
||||||
rot += fDeltaTime * 360.f;
|
rot += fDeltaTime * 360.f;
|
||||||
rot = float(fmod(rot, 360.f));
|
rot = float(fmod(rot, 360.f));
|
||||||
@@ -101,3 +104,4 @@ void Sample3dObject::DrawPrimitives()
|
|||||||
*
|
*
|
||||||
* Glenn Maynard
|
* Glenn Maynard
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,15 @@
|
|||||||
class Sample3dObject: public ActorFrame
|
class Sample3dObject: public ActorFrame
|
||||||
{
|
{
|
||||||
float rot;
|
float rot;
|
||||||
|
float fDeltaTime;
|
||||||
|
float tX;
|
||||||
|
float tY;
|
||||||
|
float tZ;
|
||||||
public:
|
public:
|
||||||
Sample3dObject();
|
Sample3dObject();
|
||||||
|
void Update();
|
||||||
|
void DrawPrimitives();
|
||||||
|
|
||||||
virtual void Update( float fDeltaTime );
|
|
||||||
virtual void DrawPrimitives();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,10 +6,21 @@
|
|||||||
Desc: Area for testing.
|
Desc: Area for testing.
|
||||||
|
|
||||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
Glenn Maynard (OpenGL Code)
|
||||||
|
Lance Gilbert (OpenGL/Usability Modifications)
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
#include "ScreenSandbox.h"
|
||||||
|
|
||||||
|
#include "RageDisplay.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "SDL.h"
|
||||||
|
#include "SDL_opengl.h"
|
||||||
#include "ScreenSandbox.h"
|
#include "ScreenSandbox.h"
|
||||||
#include "ScreenManager.h"
|
#include "ScreenManager.h"
|
||||||
#include "RageMusic.h"
|
#include "RageMusic.h"
|
||||||
@@ -22,33 +33,82 @@
|
|||||||
|
|
||||||
ScreenSandbox::ScreenSandbox()
|
ScreenSandbox::ScreenSandbox()
|
||||||
{
|
{
|
||||||
// m_Menu.Load(
|
rot = 0;
|
||||||
// THEME->GetPathTo(GRAPHIC_SELECT_STYLE_BACKGROUND),
|
tX = 0;
|
||||||
// THEME->GetPathTo(GRAPHIC_SELECT_STYLE_TOP_EDGE),
|
tY = 0;
|
||||||
// ssprintf("Use %c %c to select, then press START", char(1), char(2) ),
|
tZ = 0;
|
||||||
// false, true, 40
|
|
||||||
// );
|
|
||||||
// this->AddChild( &m_Menu );
|
|
||||||
// m_Menu.TweenOnScreenFromBlack( SM_None );
|
|
||||||
|
|
||||||
m_sprite.Load( THEME->GetPathTo("Graphics","title menu logo dance") );
|
|
||||||
m_sprite.SetXY( CENTER_X, CENTER_Y );
|
|
||||||
m_sprite.SetEffectGlowing();
|
|
||||||
this->AddChild( &m_sprite );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ScreenSandbox::Update( float fDeltaTime )
|
void ScreenSandbox::Update( float fDeltaTime )
|
||||||
{
|
{
|
||||||
Screen::Update( fDeltaTime );
|
rot += fDeltaTime * 360.f;
|
||||||
|
rot = float(fmod(rot, 360.f));
|
||||||
CArray<Packet,Packet> aPackets;
|
|
||||||
NETWORK->Recv( aPackets );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSandbox::DrawPrimitives()
|
void ScreenSandbox::DrawPrimitives()
|
||||||
{
|
{
|
||||||
Screen::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);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSandbox::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
void ScreenSandbox::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
||||||
@@ -62,17 +122,33 @@ void ScreenSandbox::Input( const DeviceInput& DeviceI, const InputEventType type
|
|||||||
switch( DeviceI.button )
|
switch( DeviceI.button )
|
||||||
{
|
{
|
||||||
case DIK_LEFT:
|
case DIK_LEFT:
|
||||||
|
glTranslatef ((tX-.1),0,0);
|
||||||
break;
|
break;
|
||||||
case DIK_RIGHT:
|
case DIK_RIGHT:
|
||||||
|
glTranslatef ((tX+.1),0,0);
|
||||||
|
break;
|
||||||
|
case DIK_UP:
|
||||||
|
glTranslatef (0,(tY-.1),0);
|
||||||
|
break;
|
||||||
|
case DIK_DOWN:
|
||||||
|
glTranslatef (0,(tY+.1),0);
|
||||||
break;
|
break;
|
||||||
case DIK_T:
|
case DIK_T:
|
||||||
break;
|
{
|
||||||
|
SDL_Event *event;
|
||||||
|
event = (SDL_Event *) malloc(sizeof(event));
|
||||||
|
event->type = SDL_QUIT;
|
||||||
|
SDL_PushEvent(event);
|
||||||
|
}
|
||||||
|
case DIK_ESCAPE:
|
||||||
|
{
|
||||||
|
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_sprBG.SetEffectCamelion( 5, D3DXCOLOR(1,0.8f,0.8f,1), D3DXCOLOR(1,0.2f,0.2f,1) );
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSandbox::HandleScreenMessage( const ScreenMessage SM )
|
void ScreenSandbox::HandleScreenMessage( const ScreenMessage SM )
|
||||||
{
|
{
|
||||||
switch( SM )
|
switch( SM )
|
||||||
|
|||||||
@@ -23,6 +23,10 @@
|
|||||||
|
|
||||||
class ScreenSandbox : public Screen
|
class ScreenSandbox : public Screen
|
||||||
{
|
{
|
||||||
|
float rot;
|
||||||
|
float tX;
|
||||||
|
float tY;
|
||||||
|
float tZ;
|
||||||
public:
|
public:
|
||||||
ScreenSandbox();
|
ScreenSandbox();
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ const CString CHOICE_TEXT[ScreenTitleMenu::NUM_TITLE_MENU_CHOICES] = {
|
|||||||
"GRAPHIC OPTIONS",
|
"GRAPHIC OPTIONS",
|
||||||
"APPEARANCE OPTIONS",
|
"APPEARANCE OPTIONS",
|
||||||
"EDIT/RECORD/SYNCH",
|
"EDIT/RECORD/SYNCH",
|
||||||
|
#ifdef _DEBUG
|
||||||
|
"SANDBOX",
|
||||||
|
#endif
|
||||||
"EXIT",
|
"EXIT",
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -221,6 +224,11 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
case CHOICE_APPEARANCE_OPTIONS:
|
case CHOICE_APPEARANCE_OPTIONS:
|
||||||
SCREENMAN->SetNewScreen( "ScreenAppearanceOptions" );
|
SCREENMAN->SetNewScreen( "ScreenAppearanceOptions" );
|
||||||
break;
|
break;
|
||||||
|
#ifdef _DEBUG
|
||||||
|
case CHOICE_SANDBOX:
|
||||||
|
SCREENMAN->SetNewScreen( "ScreenSandbox" );
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case CHOICE_EDIT:
|
case CHOICE_EDIT:
|
||||||
SCREENMAN->SetNewScreen( "ScreenEditMenu" );
|
SCREENMAN->SetNewScreen( "ScreenEditMenu" );
|
||||||
break;
|
break;
|
||||||
@@ -357,6 +365,9 @@ void ScreenTitleMenu::MenuStart( PlayerNumber pn )
|
|||||||
case CHOICE_MACHINE_OPTIONS:
|
case CHOICE_MACHINE_OPTIONS:
|
||||||
case CHOICE_GRAPHIC_OPTIONS:
|
case CHOICE_GRAPHIC_OPTIONS:
|
||||||
case CHOICE_APPEARANCE_OPTIONS:
|
case CHOICE_APPEARANCE_OPTIONS:
|
||||||
|
#ifdef _DEBUG
|
||||||
|
case CHOICE_SANDBOX:
|
||||||
|
#endif
|
||||||
m_soundSelect.PlayRandom();
|
m_soundSelect.PlayRandom();
|
||||||
m_Fade.CloseWipingRight( SM_GoToNextScreen );
|
m_Fade.CloseWipingRight( SM_GoToNextScreen );
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ public:
|
|||||||
CHOICE_GRAPHIC_OPTIONS,
|
CHOICE_GRAPHIC_OPTIONS,
|
||||||
CHOICE_APPEARANCE_OPTIONS,
|
CHOICE_APPEARANCE_OPTIONS,
|
||||||
CHOICE_EDIT,
|
CHOICE_EDIT,
|
||||||
|
#ifdef _DEBUG
|
||||||
|
CHOICE_SANDBOX,
|
||||||
|
#endif
|
||||||
CHOICE_EXIT,
|
CHOICE_EXIT,
|
||||||
NUM_TITLE_MENU_CHOICES // leave this at the end!
|
NUM_TITLE_MENU_CHOICES // leave this at the end!
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -65,6 +65,7 @@
|
|||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
#include "SDL_opengl.h"
|
#include "SDL_opengl.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#pragma comment(lib, "SDL-1.2.5/lib/SDLmaind.lib")
|
#pragma comment(lib, "SDL-1.2.5/lib/SDLmaind.lib")
|
||||||
#else
|
#else
|
||||||
@@ -384,13 +385,13 @@ int main(int argc, char* argv[])
|
|||||||
NETWORK->Init( true );
|
NETWORK->Init( true );
|
||||||
if( !NETWORK->Listen( SM_PORT ) )
|
if( !NETWORK->Listen( SM_PORT ) )
|
||||||
throw RageException( "Could not connect to server '%s'", g_sServerIP.GetString() );
|
throw RageException( "Could not connect to server '%s'", g_sServerIP.GetString() );
|
||||||
SCREENMAN->SetNewScreen( "ScreenSandbox" );
|
// SCREENMAN->SetNewScreen( "ScreenSandbox" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// normal game
|
// normal game
|
||||||
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
||||||
// SCREENMAN->SetNewScreen( "ScreenSandbox" );
|
// SCREENMAN->SetNewScreen( "ScreenSandbox" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Run the main loop. */
|
/* Run the main loop. */
|
||||||
|
|||||||
Reference in New Issue
Block a user