So... hello! I am new to AGK. I've bought it yesterday, since I wanted to create some simple apps.
Since I come from mostly OOP programming, going back to BASIC is fun but somewhat rocky.
enterTeamSelect() pretty much only loads the files and exitTeamSelect() deletes them.
_teamSelect is accessed by the main loop
I've tried a lot with DeleteSumthing but the problem remains, working memory use is rising and rising, thus everything becomes sluggish pretty quick.
Am I too spoiled by the garbage collector?
So, can someone point out the problem to me?
_teamSelect:
enterTeamSelect()
selectedCountry as integer
selectedCountry = 0
selectedLeague as integer
selectedLeague = 0
selectedTeam as integer
selectedTeam = 0
local backgroundSprite as integer
backgroundSprite = CreateSprite(BACKGROUND)
local listBox1 as integer
listBox1 = CreateSprite(LISTBOX)
local listBox2 as integer
listBox2 = CreateSprite(LISTBOX)
local listBox3 as integer
listBox3 = CreateSprite(LISTBOX)
do
SetSpriteSize(backgroundSprite, 100, 100 )
SetSpritePosition (backgroundSprite, 0, 0 )
DrawSprite(backgroundSprite)
local clickHappened as integer
clickHappened = 0
if getpointerpressed()=1
clickHappened = 1
endif
SetSpriteSize(listBox1, 20, 40 )
SetSpritePosition (listBox1, 15, 15 )
DrawSprite(listBox1)
if clickHappened = 1
local relX as integer
relX = getRelX(15, GetPointerX(), 4)
local relY as integer
relY = getRelY(15, GetPointerY(), 4)
selectedCountry = relY
endif
local text1=0
local text2=0
for c = 0 to COUNTRIES.length-1
text1 = CreateText((COUNTRIES[c].identName))
SetTextSize(text1, 4)
if c = selectedCountry
SetTextColor(text1, 100, 200, 100, 111)
else
SetTextColor(text1, 30, 100, 55, 111)
endif
SetTextPosition(text1, 16, 13 + c * 4)
next c
SetSpriteSize(listBox2, 20, 40 )
SetSpritePosition (listBox2, 35, 15 )
DrawSprite(listBox2)
for d = 0 to LEAGUES.length-1
text2 = CreateText((LEAGUES[d].shownName))
SetTextSize(text2, 4)
if d = selectedLeague
SetTextColor(text2, 100, 200, 100, 111)
else
SetTextColor(text2, 30, 100, 55, 111)
endif
SetTextPosition(text2, 35, 15 + c * 4)
next d
SetSpriteSize(listBox3, 20, 40 )
SetSpritePosition (listBox3, 55, 15 )
DrawSprite(listBox3)
Sync()
loop
exitTeamSelect()
//exitTeamSelect()
return