-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlearning.bas
56 lines (40 loc) · 1.24 KB
/
learning.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
' FBTilengine - FreeBasic binding for Tilengine - 2D retro graphics engine
' 2018 MyTDT-MySoft
'
' Screen composition using built-in SDL2 window
#include "windows.bi"
#include "Tilengine.bi"
dim as integer iFrames
dim shared as TLN_Bitmap bmBack, bmWall
const lMaxSprites = 1
const lMaxAnimations = 1
enum
lOverlay
lFore
lMaxLayers
end enum
TLN_Init(320, 240, lMaxLayers, lMaxSprites, lMaxAnimations)
TLN_SetLoadPath("assets/_png")
bmBack=TLN_LoadBitmap("background.png")
bmWall=TLN_LoadBitmap("wall.png")
TLN_CreateWindow (NULL, CWF_S2 or CWF_NEAREST or CWF_VSYNC)
TLN_DisableCRTEffect()
TLN_SetBGBitmap(bmBack)
TLN_SetLayerBitmap( lOverlay , bmWall )
TLN_SetLayerBlendMode( lOverlay , BLEND_MIX75 , 100 )
dim as integer iWallX,iWallY, iSpeedX=1,iSpeedY=1, iOff=0
dim as longint llOldTicks, llFrameTicks
const MaxOffX = 160-64 , MaxOffY = 120-64
while (TLN_ProcessWindow())
const TPS = 6000, cFPS = 60
#define Ticks() (TLN_GetTicks()*clngint(6))
while abs(Ticks()-llOldTicks) > (TPS\cFPS)
TLN_SetLayerScaling( lOverlay , 1+(iOFF/640) , 1+(iOFF/480) )
TLN_SetLayerPosition( lOverlay , iOff , (iOff*120)\160 )
iOff += 1
if iOff > 160 then iOff=160
iFrames += 1
llOldTicks += (TPS\cFPS)
wend
TLN_DrawFrame(iFrames)
wend