Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
100 lines or less...
#10
Here's my first thing...94 lines. Using my newest GDK - Has Sky Sphere, Terrain, a 3d model and controls to fly around. If people want the files i'll happily post em but i think the picture will suffice for now!

[Image: NewGDK.png]


Code: (Select All)
REM $INCLUDE:'UnseenGDK3\New_GDK.bi' '// GDK 3 Header File
DIM SHARED Terrain AS GDK_GL_Terrain, World~&, Viper AS GDK_GL_MODEL, Viper_Roll AS GDK_Range, Viper_RWD AS GDK_RWD, Viper_Pitch AS GDK_Range
GDK_System_Start "UnseenGDK3\World Demo\", 0, 0, 1024, 660, GDK_FALSE, "GDK Test - World Demo", GDK_GL_3D
GDK_GL_Set_Defaults '// If your using GL then you need to either set things up yourself of call this for a generic base
GDK_GL_Set_FOV 75
GDK_GL_Set_Clipping .1, 20000
Viper_Roll.Min = 315
Viper_Roll.Max = 405
Viper_Roll.Default = 360
Viper_Roll.Current = 360
Viper_Pitch.Min = -35
Viper_Pitch.Max = 35
Viper_RWD.Speed = 10
GDK_Allow_GL = GDK_TRUE
GDK_Init_GL = GDK_TRUE
DO
  GDK_System_Update
  IF _KEYDOWN(19200) THEN '// Left
    IF Viper_Roll.Current > Viper_Roll.Min THEN Viper_Roll.Current = Viper_Roll.Current - 2
    Viper_RWD.Rotation.Y = Viper_RWD.Rotation.Y + (1 / RAD_TO_DEG_RATIO)
  ELSEIF _KEYDOWN(19712) THEN '// Right
    IF Viper_Roll.Current < Viper_Roll.Max THEN Viper_Roll.Current = Viper_Roll.Current + 2
    Viper_RWD.Rotation.Y = Viper_RWD.Rotation.Y - (1 / RAD_TO_DEG_RATIO)
  ELSE
    IF Viper_Roll.Current < Viper_Roll.Default THEN Viper_Roll.Current = Viper_Roll.Current + 1 ELSE IF Viper_Roll.Current > Viper_Roll.Default THEN Viper_Roll.Current = Viper_Roll.Current - 1
  END IF
  IF Viper_RWD.Rotation.Y < 0 THEN Viper_RWD.Rotation.Y = Viper_RWD.Rotation.Y + TWO_Pi ELSE IF Viper_RWD.Rotation.Y > TWO_Pi THEN Viper_RWD.Rotation.Y = Viper_RWD.Rotation.Y - TWO_Pi
  IF _KEYDOWN(18432) THEN '// Up
    IF Viper_Pitch.Current < Viper_Pitch.Max THEN Viper_Pitch.Current = Viper_Pitch.Current + 1
  ELSEIF _KEYDOWN(20480) THEN '// down
    IF Viper_Pitch.Current > Viper_Pitch.Min THEN Viper_Pitch.Current = Viper_Pitch.Current - 1
  ELSE '// Return to default
    IF Viper_Pitch.Current < Viper_Pitch.Default THEN Viper_Pitch.Current = Viper_Pitch.Current + .5 ELSE IF Viper_Pitch.Current > Viper_Pitch.Default THEN Viper_Pitch.Current = Viper_Pitch.Current - .5
  END IF
  Viper_RWD.Rotation.X = Viper_Pitch.Current / RAD_TO_DEG_RATIO
  IF _KEYDOWN(ASC("A")) OR _KEYDOWN(ASC("a")) THEN
    IF Viper_RWD.Speed < 40 THEN Viper_RWD.Speed = Viper_RWD.Speed + .2
  ELSEIF _KEYDOWN(ASC("Z")) OR _KEYDOWN(ASC("z")) THEN
    IF Viper_RWD.Speed > 0 THEN Viper_RWD.Speed = Viper_RWD.Speed - .5 ELSE Viper_RWD.Speed = 0
  END IF
  GDK_RWD_Update Viper_RWD
LOOP UNTIL INKEY$ = CHR$(27)
SUB _GL
  IF GDK_System.Render_Mode = GDK_GL_2D OR GDK_System.Render_Mode = GDK_GL_3D THEN
    IF GDK_Allow_GL = GDK_TRUE THEN
      GDK_GL_Init
      IF GDK_System.GL.Lighting = GDK_FALSE THEN GDK_GL_Enable_Lighting
      IF GDK_System.GL.Culling THEN GDK_GL_Disable_Culling
      IF GDK_Init_GL = GDK_TRUE THEN
        World~& = GDK_GL_Make_World_List~&
        GDK_GL_MODEL_LOAD Viper, "Viper\tris.md2", "viper\skin.pcx"
        GDK_Init_GL = GDK_FALSE
      ELSE
        GDK_GL_CLS
        gluLookAt 0, 165, 120, 0, 0, 0, 0, 1, 0
        _GLPUSHMATRIX
        _GLLOADIDENTITY
        _GLROTATEF -Viper_RWD.Rotation.Y * RAD_TO_DEG_RATIO, 0, 1, 0
        _GLTRANSLATEF Viper_RWD.Position.X, Viper_RWD.Position.Y, Viper_RWD.Position.Z
        _GLCALLLIST World~&
        _GLPOPMATRIX
        _GLPUSHMATRIX
        _GLLOADIDENTITY
        _GLTRANSLATEF 0, -65, -150
        _GLROTATEF -90, 1, 0, 0
        _GLROTATEF 90, 0, 0, 1
        _GLROTATEF Viper_Pitch.Current, 0, 1, 0
        _GLROTATEF Viper_Roll.Current, 1, 0, 0
        GDK_GL_MODEL_DRAW Viper, 0
        _GLPOPMATRIX
        _DISPLAY
      END IF
    END IF
  END IF
END SUB
FUNCTION GDK_GL_Make_World_List~&
  goodmap% = GDK_GL_Terrain_Load(Terrain, "Hill_HMap.png", "Hill_Texture.png", 90, 3900)
  Terrain.Position.Y = -4200 ' Adjust terrain base position
  TList~& = GDK_GL_Terrain_Make_List(Terrain)
  SkyList~& = GDK_GL_CreateSphereList(12000, 120, 120, GDK_GL_Load_Texture("Sky.png")) '// This is so cool, dont even have to load then pass the image!
  TmpList~& = _GLGENLISTS(1)
  _GLNEWLIST TmpList~&, _GL_COMPILE
  _GLPUSHMATRIX
  _GLTRANSLATEF 0, Terrain.Position.Y, 0
  _GLCALLLIST TList~&
  _GLPOPMATRIX
  _GLPUSHMATRIX
  _GLROTATEF 180, 1, 0, 0
  _GLCALLLIST SkyList~&
  _GLPOPMATRIX
  _GLENDLIST '// Finihsed everything so stop making the lists
  GDK_GL_Make_World_List~& = TmpList~&
END FUNCTION
REM $INCLUDE:'UnseenGDK3\New_GDK.bm' '// UnseenGDK 3 Lib file // change nothing but addint the pitch functionalaity

john
Reply


Messages In This Thread
100 lines or less... - by Unseen Machine - 10-24-2025, 01:40 AM
RE: 100 lines or less... - by tantalus - 10-24-2025, 07:45 AM
RE: 100 lines or less... - by Magdha - 10-24-2025, 08:06 AM
RE: 100 lines or less... - by bplus - 10-24-2025, 12:19 PM
RE: 100 lines or less... - by SMcNeill - 10-24-2025, 01:17 PM
RE: 100 lines or less... - by bplus - 10-24-2025, 04:05 PM
RE: 100 lines or less... - by SMcNeill - 10-24-2025, 06:37 PM
RE: 100 lines or less... - by Unseen Machine - 10-24-2025, 09:46 PM
RE: 100 lines or less... - by madscijr - 10-24-2025, 10:10 PM
RE: 100 lines or less... - by bplus - 10-25-2025, 12:15 AM
RE: 100 lines or less... - by dbox - 10-25-2025, 01:49 AM
RE: 100 lines or less... - by Unseen Machine - 10-24-2025, 11:08 PM
RE: 100 lines or less... - by dbox - 10-24-2025, 11:32 PM
RE: 100 lines or less... - by Dav - 10-24-2025, 11:44 PM
RE: 100 lines or less... - by dbox - 10-25-2025, 12:10 AM
RE: 100 lines or less... - by Unseen Machine - 10-25-2025, 01:59 AM
RE: 100 lines or less... - by Unseen Machine - 11-01-2025, 03:06 AM
RE: 100 lines or less... - by MasterGy - 11-01-2025, 10:33 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Bouncing lines & boxes Dav 6 1,947 04-12-2025, 06:14 AM
Last Post: madscijr
  100 prisoners' problem TempodiBasic 9 2,677 04-17-2023, 07:30 PM
Last Post: bplus
  My masterpiece - 13,500+ lines - WIM-Tools, Windows Image Management Tools hanness 0 620 05-09-2022, 09:58 PM
Last Post: hanness

Forum Jump:


Users browsing this thread: 1 Guest(s)