Code: Select all
using System;
using System.Collections.Generic;
using IrrlichtLime;
using IrrlichtLime.Core;
using IrrlichtLime.Video;
using IrrlichtLime.Scene;
using System.Diagnostics;
namespace MyIrr2D {
class Program {
static IrrlichtDevice d = IrrlichtDevice.CreateDevice(DriverType.Direct3D9,new Dimension2Di(1000,500));
static VideoDriver v;
static SceneNode s;
static int i = 0;
static Texture t;
static void Main(string [] args) {
v = d.VideoDriver;
s = d.SceneManager.AddSceneNode("SceneNode");
t = v.GetTexture("T.png");
d.OnEvent += d_OnEvent;
d.Run();
while( true ) {
Draw();
}
}
static bool d_OnEvent(Event evnt) {
switch( evnt.Type ) {
}
Console.WriteLine( evnt );
return true;
}
static void Draw() {
v.ClearBuffers( ClearBufferFlag.Color, Color.OpaqueBlue );
PF( ()=>{
v.BeginScene(ClearBufferFlag.Color);
for( int q = 1; q <= 1000; q++ ) {
v.Draw2DImage( t,new Recti(10,20,200,500), new Recti(new Vector2Di(0),t.Size) );
}
v.EndScene();
} );
}
static void PF( Action a ) {
var w = new Stopwatch();
w.Start();
a();
w.Stop();
Console.WriteLine( a.Method.Name+": "+w.ElapsedMilliseconds );
//Console.WriteLine( "GC={0}",GC.GetTotalMemory(false) );
//GC.Collect();
}
}
}