Swing (PB Version 4.60 RC2 Only)

Advanced game related topics
User avatar
falsam
Enthusiast
Enthusiast
Posts: 635
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Swing (PB Version 4.60 RC2 Only)

Post by falsam »

Code: Select all

EnableExplicit

Enumeration 10
  #Camera
  #Light
  
  #Cube
  #Cube_Mesh
  
  #Cylindre
  #Cylindre_Mesh
  
  #Sphere
  #Sphere_Mesh
  
  #Ground
  #Ground_Mesh
EndEnumeration


Global Entity.i, RotX.i, RotY.i, RotZ, i.f, Sense.s="Right"
If InitEngine3D()
  InitSprite()
  InitKeyboard()
  InitMouse()

  OpenWindow(0,0,0,800,600,"3d",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
  OpenWindowedScreen(WindowID(0),0,0,800,600,0,0,0)

  WorldShadows(#PB_Shadow_Additive)

  EnableWorldPhysics(1) 

  CreateCamera(#Camera,0,0,800,600)
  CameraLocate(#Camera,5,5,-20)
  CameraLookAt(#Camera,5,5,0)
  CreateLight(#Light,RGB(255,255,255),0,50,-20)

  CreateCylinder(#Cylindre_Mesh, 1, 5) 
  CreateEntity(#Cylindre, MeshID(#Cylindre_Mesh), #PB_Material_None)
  EntityLocate(#Cylindre, 1, 1,0)
  RotateEntity(#Cylindre, 90, 0, 90)

  CreateCube(#Cube_Mesh, 1)
  CreateEntity(#Cube, MeshID(#cube_Mesh), #PB_Material_None)
  ResizeEntity(#Cube, 15, 0.2, 5)
  EntityLocate(#Cube, 1, 2.2, 0)
  RotateEntity(#Cube, 0, 0, -18)
  EntityPhysicBody(#Cube, #PB_Entity_StaticBody, 2, 0, 0)

  CreateSphere(#Sphere_Mesh, 1) 
  CreateEntity(#Sphere, MeshID(#Sphere_Mesh), #PB_Material_None)
  EntityLocate(#Sphere, -1, 6,0)
  EntityPhysicBody(#Sphere, #PB_Entity_BoxBody, 1, 0, 1)

  CreateCube(#Ground_Mesh, 20)
  CreateEntity(#Ground,MeshID(#Ground_Mesh), #PB_Material_None)
  EntityLocate(#Ground,5,-10,-5)
  EntityPhysicBody(#Ground, #PB_Entity_StaticBody, 1, 0, 0)

  Repeat
   RenderWorld()
  
    ;Balançoire
   If i<18 And Sense="Right"
     i + 0.3
   Else
     Sense="Left"
   EndIf
  
  
   If i>-18 And Sense="Left"
    i - 0.3
   Else
    Sense="Right"
   EndIf
   RotateEntity(#Cube, 0, 0, i)
   
   If ExamineMouse()
     RotY = -MouseDeltaX()/10 
     RotX = -MouseDeltaY()/10  
   EndIf
       
   RotateCamera(#Camera, RotX, RotY, RotZ, #PB_Relative)
  
   FlipBuffers()
  
   ExamineKeyboard() 
   If KeyboardPushed(#PB_Key_Escape)
     End
   EndIf
  
 ForEver
Else
  MessageRequester("Information", "Impossible d'initialiser le moteur 3D")
EndIf
 
Last edited by falsam on Tue Oct 18, 2011 8:22 pm, edited 1 time in total.

➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect 🤪
User avatar
Demivec
Addict
Addict
Posts: 4282
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Swing (PB Version 4.60 RC2 Only)

Post by Demivec »

I get an IMA when running this code at line 70 (@RenderWorld()). I'm running x86 using DirectX9. ASCII.
User avatar
falsam
Enthusiast
Enthusiast
Posts: 635
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: Swing (PB Version 4.60 RC2 Only)

Post by falsam »

I'm running x86 using DirectX11 and I have no error.

Window 7 ? Window XP ?

➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect 🤪
User avatar
Demivec
Addict
Addict
Posts: 4282
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Swing (PB Version 4.60 RC2 Only)

Post by Demivec »

falsam wrote:I'm running x86 using DirectX11 and I have no error.

Window 7 ? Window XP ?
Window XP. I would presume the changes in DirectX11, and their lack in DirectX9, are responsible for the crash.
User avatar
Kuron
Addict
Addict
Posts: 1626
Joined: Sat Oct 17, 2009 10:51 pm
Location: Pacific Northwest

Re: Swing (PB Version 4.60 RC2 Only)

Post by Kuron »

Demivec wrote: Window XP. I would presume the changes in DirectX11, and their lack in DirectX9, are responsible for the crash.

XP does not support DX11. XP only supports up to DX9.
Best wishes to the PB community. Thank you for the memories. ♥️
User avatar
Demivec
Addict
Addict
Posts: 4282
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Swing (PB Version 4.60 RC2 Only)

Post by Demivec »

Kuron wrote:
Demivec wrote: Window XP. I would presume the changes in DirectX11, and their lack in DirectX9, are responsible for the crash.

XP does not support DX11. XP only supports up to DX9.
@Kuron: Yes, it was apparent to me when the target compilation was for Windows 7. :wink:
User avatar
falsam
Enthusiast
Enthusiast
Posts: 635
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: Swing (PB Version 4.60 RC2 Only)

Post by falsam »

I restart my computer with Windows XP and I test. :)

➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect 🤪
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Swing (PB Version 4.60 RC2 Only)

Post by c4s »

Same setup as Demivec here (XP, x86) but no crash. Works fine, except of stuttering camera on slow mouse movements. :wink:
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
User avatar
Demivec
Addict
Addict
Posts: 4282
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Swing (PB Version 4.60 RC2 Only)

Post by Demivec »

I did get it to function using the OpenGL subsystem.
User avatar
falsam
Enthusiast
Enthusiast
Posts: 635
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: Swing (PB Version 4.60 RC2 Only)

Post by falsam »

Windows 7, DirectX 11: This code works
Window XP, DirectX 9.0C : This code works

➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect 🤪
User avatar
bembulak
Enthusiast
Enthusiast
Posts: 576
Joined: Mon Mar 06, 2006 3:53 pm
Location: Austria

Re: Swing (PB Version 4.60 RC2 Only)

Post by bembulak »

Works here on my Win XP SP3/32 bit box,
but unfortunately my Minx Linux 10 Box crashes on RenderWorld()!
:(
cheers,

bembulak
Post Reply