In the EasyTOK.bb line number : 618
Replace
ScaleEntity
With
ScaleMesh
Replace
ScaleEntity
With
ScaleMesh
;======================================================================================= ; Code : ; Project Title : ; Author : Philippe Agnisola ; Email : ; Version : 1.0.0 ; Date : ; Notes : ; ; ;======================================================================================= Include "Inc_TimeMachine.bb" Include "Inc_EasyTOK.bb" ; ------------------------ ; Freelook cam var ; ------------------------ Global Mouse_X_Speed# Global Mouse_Y_Speed# Global Camera_VelX# Global Camera_VelZ# Global Camera_Pitch Global Camera_Yaw ; ------------------------------- ; Refresh frame number ; ------------------------------- Global AppFPS =60 ; ------------------ ; Open screen ; ------------------ Graphics3D 1024, 768,32,0 SetBuffer BackBuffer () ; ---------------------- ; Change font text ; ---------------------- AppFont=LoadFont("Arial",15,1,0,0) SetFont AppFont ; ------------------------------------- ; Setup camera and Easytok ; ------------------------------------- Global Cam=CreateCamera() PositionEntity Cam,0,90,-120 Proc_CreateVisor() TOK_InitWorld(0,-40,0,1000,100) ; ----------------------------- ; Creating demo world ; ----------------------------- Global Light1=CreateLight(2) PositionEntity Light1,-50,50,-50 LightColor Light1,250,150,50 LightRange Light1,100 Global Light2=CreateLight(2) PositionEntity Light2,50,50,50 LightColor Light2,50,150,250 LightRange Light2,100 AmbientLight 80,90,100 TOK_CreateABCube("Wall01",15 ,150,0,0,0,20,15,2,15,"",255,255,255,1) TOK_CreateABCube("Wall02",-15 ,120,0,0,0,-20,15,2,15,"",255,255,255,1) TOK_CreateABCube("Wall03",15 ,90,0,0,0,20,15,2,15,"",255,255,255,1) TOK_CreateABCube("Wall04",-15,60,0,0,0,-20,15,2,15,"",255,255,255,1) TOK_CreateABCube("Wall05",15 ,30,0, 0,0,20,15,2,15,"",255,255,255,1) ; ------------- ; Main loop ; ------------- FramePeriod = 1000 / AppFPS FrameTime = MilliSecs () - FramePeriod MoveMouse GraphicsWidth()/2, GraphicsHeight()/2 Global g_clock = MilliSecs() Repeat ; -------------------------- ; Frame rate limiting ; -------------------------- Repeat FrameElapsed = MilliSecs () - FrameTime Until FrameElapsed FrameTicks = FrameElapsed / FramePeriod FrameTween# = Float (FrameElapsed Mod FramePeriod) / Float (FramePeriod) ; ----------------------- ; Update tweening ; ----------------------- For FrameLimit = 1 To FrameTicks If FrameLimit = FrameTicks Then CaptureWorld EndIf FrameTime = FrameTime + FramePeriod UpdateGame () UpdateWorld Next ; ------------------- ; Redraw world ; ------------------- TOK_RefreshEasyTOK() RenderWorld FrameTween ; ----------------------- ; FPS Displaying ; ----------------------- Proc_CinemaStrip() Color 255,255,255 Information$="<"+Get_FPS()+" FPS> / "+"<Arrow key to move> / <Mouse left to launch objecst> / <Mouse right to apply impulse Y>" Text GraphicsWidth()/2,GraphicsHeight()-30,Information$,True,True Flip Until KeyHit (1) ; ----------- ; End App ; ----------- TOK_FreePhysic() FreeFont AppFont End ; ----------------------------------- ; Tweening update function ; ----------------------------------- Function UpdateGame () Proc_Freelook(Cam,1.05,0.05) If MilliSecs() > g_clock + 1000 g_clock = MilliSecs() Width#=3 sphere = CreateSphere() TOK_CreateRBSphere("Toto1",sphere,10,180,0,0,0,0,Width#,5,"",255,Rnd(255),255,1,5) EndIf If MouseHit(2) Then TOK_ApplyImpulse("",Rnd(-5,5),Rnd(55,165),Rnd(-5,5)) EndIf TOK_RefreshPhysic(1.7/AppFPS,70) End Function ; ----------------------- ; Create the visor ; ----------------------- Function Proc_CreateVisor() Visor=LoadSprite("./ETOK_Medias/Target.png") PositionEntity Visor,EntityX(Cam),EntityY(Cam),EntityZ(Cam)+2 ScaleSprite Visor,0.1,0.1 EntityParent Visor,Cam EntityOrder Visor,-1 End Function ; ---------------------------------- ; Create the cinema strip ; ---------------------------------- Function Proc_CinemaStrip(Size=60) Color 1,1,1 Rect 0,0,GraphicsWidth(),Size Rect 0,GraphicsHeight()-Size,GraphicsWidth(),Size End Function ; ---------------------- ; Camera freelook ; ---------------------- Function Proc_Freelook(CamEntity,Velocity#,Speed#) Mouse_X_Speed#=MouseXSpeed()*0.5 Mouse_Y_Speed#=MouseYSpeed()*0.5 MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 Camera_Pitch=Camera_Pitch+Mouse_Y_Speed# Camera_Yaw=Camera_Yaw+Mouse_X_Speed# RotateEntity CamEntity,Camera_Pitch,-Camera_Yaw,0 If KeyDown(203) Then Camera_VelX=Camera_VelX-Speed# ElseIf KeyDown(205) Camera_VelX=Camera_VelX+Speed# EndIf If KeyDown(208) Then Camera_VelZ=Camera_VelZ-Speed# ElseIf KeyDown(200) Camera_VelZ=Camera_VelZ+Speed# EndIf Camera_VelX=Camera_VelX/velocity# Camera_VelZ=Camera_VelZ/velocity# MoveEntity CamEntity,Camera_VelX,0,Camera_VelZ If KeyDown(200) Then MoveEntity CamEntity,0,0,Speed# EndIf If KeyDown(208) Then MoveEntity CamEntity,0,0,-Speed# EndIf If KeyDown(205) Then MoveEntity CamEntity,Speed#,0,0 EndIf If KeyDown(203) Then MoveEntity CamEntity,-Speed#,0,0 EndIf End Function