Permalink
Browse files

Fixed a lot o compile errors in Altona

  • Loading branch information...
1 parent 6d80581 commit c8ff39c2328c21c65a30d96d5f66947fb94b13da @kebby kebby committed May 5, 2012
@@ -137,9 +137,9 @@ void MyApp::OnPaint3D()
// onkey: check for escape
-void MyApp::OnInput(const sInputEvent &ie)
+void MyApp::OnInput(const sInput2Event &ie)
{
- if(ie.DeviceType==sIED_KEYBOARD && (ie.Key&sKEYQ_MASK)==sKEY_ESCAPE) sExit();
+ if( (ie.Key&sKEYQ_MASK)==sKEY_ESCAPE) sExit();
}
/****************************************************************************/
@@ -37,7 +37,7 @@ class MyApp : public sApp
MyApp();
~MyApp();
void OnPaint3D();
- void OnInput(const sInputEvent &ie);
+ void OnInput(const sInput2Event &ie);
};
/****************************************************************************/
@@ -138,9 +138,9 @@ void MyApp::OnPaint3D()
// onkey: check for escape
-void MyApp::OnInput(const sInputEvent &ie)
+void MyApp::OnInput(const sInput2Event &ie)
{
- if(ie.DeviceType==sIED_KEYBOARD && (ie.Key&sKEYQ_MASK)==sKEY_ESCAPE) sExit();
+ if((ie.Key&sKEYQ_MASK)==sKEY_ESCAPE) sExit();
}
/****************************************************************************/
@@ -37,7 +37,7 @@ class MyApp : public sApp
MyApp();
~MyApp();
void OnPaint3D();
- void OnInput(const sInputEvent &ie);
+ void OnInput(const sInput2Event &ie);
};
/****************************************************************************/
@@ -15,10 +15,6 @@
#include "base/input2.hpp"
#include "base/windows.hpp"
#include "util/shaders.hpp"
-#if sCONFIG_SDK_TC3
-#include "consoles/system2.hpp"
-#include "consoles/input2.hpp"
-#endif
/****************************************************************************/
@@ -1,22 +0,0 @@
-/*+**************************************************************************/
-/*** ***/
-/*** This file is distributed under a BSD license. ***/
-/*** See LICENSE.txt for details. ***/
-/*** ***/
-/**************************************************************************+*/
-
-guid "{E81B2220-C048-471b-9BE1-AA9D448920FE}";
-
-license altona;
-include "altona/main";
-
-create "debug_dx9";
-create "debugfast_dx9";
-create "release_dx9";
-
-depend "altona/main/base";
-depend "altona/main/util";
-
-
-file "main.?pp";
-file "inputasync.mp.txt";
@@ -1,239 +0,0 @@
-/*+**************************************************************************/
-/*** ***/
-/*** This file is distributed under a BSD license. ***/
-/*** See LICENSE.txt for details. ***/
-/*** ***/
-/**************************************************************************+*/
-
-/****************************************************************************/
-/*** ***/
-/*** (C) 2005 Dierk Ohlerich, all rights reserved ***/
-/*** ***/
-/****************************************************************************/
-
-#include "main.hpp"
-#include "base/windows.hpp"
-#include "util/shaders.hpp"
-#include "base/system.hpp"
-
-/****************************************************************************/
-
-MyApp::MyApp()
-{
- Painter = new sPainter;
- Geo = new sGeometry();
- Geo->Init(sGF_TRILIST|sGF_INDEX16,sVertexFormatStandard);
-
- Mtrl = new sSimpleMaterial;
- Mtrl->Flags = sMTRL_LIGHTING | sMTRL_ZON;
- Mtrl->Prepare(sVertexFormatStandard);
-
- Load = 1;
-
-
- for(sInt c=0;c<MAX_CHANNELS;c++)
- for(sInt s=0;s<MAX_STEPS;s++)
- Buffer[c][s] = sInt(sFSin(s*c*0.01f)*0x8000+0x8000);
- for(sInt c=0;c<MAX_CHANNELS;c++)
- State[c] = 0x8000;
- Index = 0;
- TimeStamp = sGetTime();
-}
-
-MyApp::~MyApp()
-{
- delete Painter;
- delete Geo;
- delete Mtrl;
-}
-
-void MyApp::OnPaint3D()
-{
- GetInput();
- PaintCube();
- Painter->SetTarget();
- Painter->Begin();
- Painter->SetPrint(0,~0,1);
- PrintInput();
- PrintGraph();
- Painter->End();
-
- // make XBOX controllers rumble...
-
- sJoypad *pad;
- sJoypadData data;
- sInt max = sGetJoypadCount();
- for(sInt i=0;i<max;i++)
- {
- pad = sGetJoypad(i);
- sVERIFY(pad);
- pad->GetData(data);
- pad->SetMotor(data.Pressure[10],data.Pressure[11]);
- }
-}
-
-void MyApp::PaintCube()
-{
- sSetRendertarget(0,sCLEAR_ALL,0xff405060);
-
- Env.AmbientColor = 0xff404040;
- Env.LightColor[0] = 0x00c00000;
- Env.LightColor[1] = 0x0000c000;
- Env.LightColor[2] = 0x000000c0;
- Env.LightDir[0].Init(1,0,0);
- Env.LightDir[1].Init(0,1,0);
- Env.LightDir[2].Init(0,0,1);
-
- Timer.OnFrame(sGetTime());
- sInt time = Timer.GetTime();
-
- View.Camera.EulerXYZ(time*0.0011f,time*0.0013f,time*0.0015f);
- View.SetTargetCurrent();
- View.SetZoom(1);
- View.Camera.l = sVector31(View.Camera.k*-2);
-
- sVertexStandard *vp;
- sU16 *ip;
- Geo->BeginLoadVB(8,sGD_STREAM,(void **)&vp);
- sF32 t = 0.4f/(Load);
- vp[0].Init(-t,-t,-t, -1,-1,-1, 0,0);
- vp[1].Init( t,-t,-t, 1,-1,-1, 1,0);
- vp[2].Init( t, t,-t, 1, 1,-1, 1,1);
- vp[3].Init(-t, t,-t, -1, 1,-1, 0,1);
- vp[4].Init(-t,-t, t, -1,-1, 1, 0,0);
- vp[5].Init( t,-t, t, 1,-1, 1, 1,0);
- vp[6].Init( t, t, t, 1, 1, 1, 1,1);
- vp[7].Init(-t, t, t, -1, 1, 1, 0,1);
- Geo->EndLoadVB();
- Geo->BeginLoadIB(6*6,sGD_STREAM,(void **)&ip);
- sQuad(ip,0,3,2,1,0);
- sQuad(ip,0,4,5,6,7);
- sQuad(ip,0,0,1,5,4);
- sQuad(ip,0,1,2,6,5);
- sQuad(ip,0,2,3,7,6);
- sQuad(ip,0,3,0,4,7);
- Geo->EndLoadIB();
-
- sF32 s = 1.0f/Load;
- for(sInt x=1-Load;x<Load;x++)
- {
- for(sInt y=1-Load;y<Load;y++)
- {
- for(sInt z=1-Load;z<Load;z++)
- {
- View.Model.l.Init(x*s,y*s,z*s);
- View.Prepare();
- //View.Set();
- sCBuffer<sSimpleMaterialEnvPara> cb;
- cb.Data->Set(View,Env);
- cb.Modify();
- Mtrl->Set(&cb);
- Geo->Draw();
- }
- }
- }
-
-}
-
-void MyApp::PrintInput()
-{
- sF32 avg = Timer.GetAverageDelta();
- sInt y = 10;
- Painter->PrintF(10,y,L"%5.2ffps %5.3fms",1000/avg,avg); y+=10;
- Painter->PrintF(10,y,L"press keys '1'..'9' to set load"); y+=10;
-}
-
-void MyApp::GetInput()
-{
- sInputFIFOEvent data;
- while(sInputQueue->GetNextEvent(data,1))
- {
- if(data.DeviceType==sIED_JOYPAD && data.DeviceId==0)
- {
- ChannelMask = data.Data.Joypad.AnalogMask;
- if(data.Timestamp > TimeStamp+1000)
- {
- TimeStamp = data.Timestamp;
- }
- while(TimeStamp < data.Timestamp)
- {
- TimeStamp+=1;
- for(sInt c=0;c<MAX_CHANNELS;c++)
- Buffer[c][Index] = State[c];
- Index = (Index+1)&(MAX_STEPS-1);
- }
- for(sInt c=0;c<MAX_CHANNELS;c++)
- State[c] = data.Data.Joypad.Analog[c];
- }
- }
-}
-
-void MyApp::PrintGraph()
-{
- sF32 xo,xs,yo,ys;
- sF32 x0,x1,y0,y1;
- sInt sx,sy;
-
- sGetScreenSize(sx,sy);
-
- xo = 0;
- xs = sF32(sx)/MAX_STEPS;
- yo = sF32((sy-sy/3*2)/2);
- ys = sF32(sy/3)/0x8000;
-
- for(sInt c=0;c<MAX_CHANNELS;c++)
- {
- if(ChannelMask & (1<<c))
- {
- x0 = xo;
- y0 = Buffer[c][0]*ys+yo;
-
- for(sInt s=1;s<MAX_STEPS;s++)
- {
- x1 = x0;
- y1 = y0;
- x0 = s*xs+xo;
- y0 = Buffer[c][s]*ys+yo;
- Painter->Line(x0,y0,x1,y1,~0,~0,1);
- }
- }
- }
-
- for(sInt i=0;i<100;i+=10)
- {
- x0 = i*xs+xo;
- y0 = 0x6000*ys+yo;
- x1 = i*xs+xo;
- y1 = 0xa000*ys+yo;
- Painter->Line(x0,y0,x1,y1,~0,~0,0);
- }
-}
-
-void MyApp::OnInput(const sInput2Event &ie)
-{
- switch(ie.Key)
- {
- case 27:
- sExit();
- break;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- Load = ie.Key - '0';
- break;
- }
-}
-
-void sMain()
-{
- sInit(sISF_3D|sISF_CONTINUOUS,640,480);
- sSetApp(new MyApp());
- sSetWindowName(L"Cube");
-}
-
@@ -1,54 +0,0 @@
-/*+**************************************************************************/
-/*** ***/
-/*** This file is distributed under a BSD license. ***/
-/*** See LICENSE.txt for details. ***/
-/*** ***/
-/**************************************************************************+*/
-
-/****************************************************************************/
-/*** ***/
-/*** (C) 2005 Dierk Ohlerich, all rights reserved ***/
-/*** ***/
-/****************************************************************************/
-
-#pragma once
-
-#include "base/system.hpp"
-#include "util/painter.hpp"
-#include "base/graphics.hpp"
-
-/****************************************************************************/
-
-#define MAX_STEPS 512
-#define MAX_CHANNELS 8
-
-class MyApp : public sApp
-{
- sPainter *Painter;
- sMaterial *Mtrl;
- sGeometry *Geo;
- sInt Load;
-
- sViewport View;
- sMaterialEnv Env;
-
- sTiming Timer;
-
- void GetInput();
- void PaintCube();
- void PrintInput();
- void PrintGraph();
-
- sInt Buffer[MAX_CHANNELS][MAX_STEPS];
- sInt State[MAX_CHANNELS];
- sInt Index;
- sInt TimeStamp;
- sInt ChannelMask;
-public:
- MyApp();
- ~MyApp();
- void OnPaint3D();
- void OnInput(const sInput2Event &ie);
-};
-
-/****************************************************************************/
@@ -58,7 +58,7 @@ void sMain()
{
ray.Start.x = rand.Float(4.0f);
ray.Start.z = rand.Float(4.0f);
- nHits2 += ray.HitBilinearPatch(dist,p00,p01,p10,p11) ? 1 : 0;
+ nHits2 += ray.HitBilinearPatch(dist,p00,p01,p10,p11,0,0) ? 1 : 0;
}
time2 = sGetTime() - time2;
@@ -6,7 +6,7 @@
/**************************************************************************+*/
#include "main.hpp"
-#include "network/httpserver.hpp"
+#include "network/http.hpp"
const sChar8 Stylesheet[] =
"body {"
Oops, something went wrong.

0 comments on commit c8ff39c

Please sign in to comment.