SHARE
TWEET

Untitled

a guest Jul 13th, 2019 134 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CompilerIf #PB_Compiler_OS <> #PB_OS_Windows
  2.    Structure POINT
  3.      x.l
  4.      y.l
  5.    EndStructure
  6. CompilerEndIf
  7.  
  8. #sw = 1024
  9. #sh = 768
  10. #sn = "Sinus"
  11.  
  12. #hsw = #sw/2 : #hsh = #sh/2
  13.  
  14. If InitSprite()=0 Or InitKeyboard()=0
  15.   MessageRequester("ERROR","Cant init game engine !"):End
  16. EndIf
  17.  
  18. If OpenScreen(#sw,#sh,32,#sn)=0
  19.   If OpenScreen(#sw,#sh,24,#sn)=0
  20.         MessageRequester("ERROR","Cant open screen !"):End
  21. EndIf:EndIf
  22.  
  23. Procedure Point3Dto2D(x.f,y.f,z.f,*pt.POINT)
  24.   #proj = 150 ; gew√∂hnlich 100
  25.   z + 1
  26.   *pt\x = Round((x/z)* #proj+#hsw,1)
  27.   *pt\y = Round((y/z)*-#proj+#hsh,1)
  28. EndProcedure
  29.  
  30. Procedure Line3D(x1.f,y1.f,z1.f,x2.f,y2.f,z2.f,color)
  31.   ; draw a line in 3D space
  32.   Point3Dto2D(x1,y1,z1,p1.POINT)
  33.   Point3Dto2D(x2,y2,z2,p2.POINT)
  34.   If color = -1
  35.     LineXY(p1\x,p1\y,p2\x,p2\y)
  36.   Else
  37.     LineXY(p1\x,p1\y,p2\x,p2\y,color)
  38.   EndIf
  39. EndProcedure
  40.  
  41. schrittweite = 5 : z.f = 0 : obj_y.f = 0 : obj_x.f = 0 : obj_z.f = -0.5
  42.  
  43. Repeat
  44.     ExamineKeyboard()
  45.     FlipBuffers()
  46.     If IsScreenActive()
  47.       ClearScreen (0)
  48.       If StartDrawing(ScreenOutput())
  49.           FrontColor(RGB($FF,$FF,$00))
  50.           For x = 0 To 60 Step 3
  51.               For y = 0 To 60 Step 3
  52.                   For c = 0 To 10
  53.                       Line3D(obj_x-0.1*x+0.025,obj_y-0.1*y,obj_z+0.01*c,obj_x-0.1*x+0.025,obj_y-0.1*y,obj_z+0.01*c+0.01,RGB(255-25*c,255-25*c,255-25*c))
  54.                   Next
  55.                   Line3D(obj_x-0.1*x      ,obj_y-0.1*y      ,obj_z,obj_x-0.1*x+0.05 ,obj_y-0.1*y      ,obj_z,$FFFFFF)
  56.                   Line3D(obj_x-0.1*x+0.025,obj_y-0.1*y-0.025,obj_z,obj_x-0.1*x+0.025,obj_y-0.1*y+0.025,obj_z,$FFFFFF)
  57.               Next
  58.           Next
  59.           FrontColor(RGB(255, 255, 255))
  60.           DrawingMode(1)
  61.           DrawText(50,50, "Cursor Keys left/right & up/down to move object")
  62.           DrawText(50,70, "Keypad +/- to z00m object")
  63.           StopDrawing()
  64.       EndIf
  65.  
  66.       If KeyboardPushed(#PB_Key_Up)
  67.         obj_y + 0.01
  68.       ElseIf KeyboardPushed(#PB_Key_Down)
  69.         obj_y - 0.01
  70.       ElseIf KeyboardPushed(#PB_Key_Left)
  71.         obj_x - 0.01
  72.       ElseIf KeyboardPushed(#PB_Key_Right)
  73.         obj_x + 0.01
  74.       ElseIf KeyboardPushed(#PB_Key_Add)      ; keypad +
  75.         obj_z - 0.01
  76.       ElseIf KeyboardPushed(#PB_Key_Subtract) ; keypad -
  77.         obj_z + 0.01
  78.       EndIf
  79.       If keypressed : keypressed - 1 : EndIf    
  80.  
  81.       Delay(10)
  82.  
  83.     EndIf
  84. Until KeyboardPushed(#PB_Key_Escape)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top