It works pretty good. Too bad elipse is somewhat lacking in terms of code completion.. Otherwise python lovers should really try LW in python.
This is a converted sample:
'''
Created on Aug 24, 2011
@author: rndbit
'''
import clr
clr.AddReference('IronPython')
clr.AddReference('StdLib')
clr.AddReference('LE.NET')
from LeadwerksEngine import *
import System, sys
def UpdateCallback(ent):
LE.TurnEntity(ent, TVec3(LE.AppSpeed() * 0.5));
def ErrOut( message ):
System.Console.WriteLine( message );
def main(argv):
# Initialize
LE.Initialize()
LE.SetAppTitle('Test')
LE.RegisterAbstractPath('C:/Leadwerks Engine SDK')
# Set graphics mode
if LE.Graphics(800,600) == 0:
ErrOut( "Failed to set graphics mode." )
return
# Create framework object and set it to a global object so other scripts can access it
fw = LE.CreateFramework()
if not fw.IsValid:
ErrOut( "Failed to initialize engine." )
return
# Set Lua framework object
LE.SetGlobalObject( "fw", fw.Handle )
# Set Lua framework variable
lua = LE.GetLuaState()
LE.lua_pushobject( lua, fw.Handle )
LE.lua_setglobal( lua, "fw" )
LE.lua_pop( lua, 1 )
# Get framework main camera
camera = LE.GetLayerCamera( LE.GetFrameworkLayer(0) )
LE.PositionEntity( camera, TVec3(0,0,-2) )
# Create cube
material = LE.LoadMaterial( "abstract::cobblestones.mat" )
mesh = LE.CreateCube(TEntity())
LE.PaintEntity( mesh, material )
# Apply callback
cb = LE.EntityUpdateWorldCallback(UpdateCallback)
LE.SetEntityCallback(mesh.Entity, cb )
# Create ground
ground = LE.CreateCube(TEntity())
LE.ScaleEntity( ground, TVec3(10,1,10) )
LE.PositionEntity( ground, TVec3(0,-2,0) )
LE.PaintEntity( ground, material )
# Add some light
light = LE.CreateDirectionalLight(TEntity())
LE.RotateEntity( light, TVec3(45,45,45) )
# Spin cube until user hits Escape
while not LE.KeyHit() and not LE.AppTerminate():
if not LE.AppSuspended():
LE.TurnEntity( mesh, TVec3( LE.AppSpeed()*0.5 ) )
LE.UpdateFramework()
LE.RenderFramework()
LE.DrawText("C# LE.NET", 0, 20)
LE.Flip( 0 )
if __name__ == '__main__':
main(sys.argv)