Post by Ralph on Mar 23, 2005 16:36:27 GMT
New to Sprite Candy I have to find out how things are programmed. Maybe someone that is into it already can provide some hints...
What I am doing is:
I have a Function that changes the Highscore Array into a txt$ to pass to HUD_CreateText(..)
Have added "SCORE" to LEFT CENTER and RIGHT at all places I found.
Because I want to have the Numbers right aligned and same charwidth (Rank, (optional) Games Played and Scores) and the Names left aligned after Rank number with normal charwidth.
Spaces if part of Numbers same width as the numbers otherwise normal.
And this is then worked out in SC_RenderVertices()
Well ... better continue to find what I'm doing wrong ...
Bye
[edit] Maybe I should explain what ~ and § are for.
~ is changed by SC_RenderVertices to a dot ( . ) This way Players can use . in their name for Initials - otherwise you would have to check that after the name input and disallow.
§ passes how many chars are left in the line - so x can be adjusted in SC_RenderVertices ... right margin minus count * NumMaxwidth ...
What I am doing is:
I have a Function that changes the Highscore Array into a txt$ to pass to HUD_CreateText(..)
Have added "SCORE" to LEFT CENTER and RIGHT at all places I found.
Because I want to have the Numbers right aligned and same charwidth (Rank, (optional) Games Played and Scores) and the Names left aligned after Rank number with normal charwidth.
Spaces if part of Numbers same width as the numbers otherwise normal.
; ------------------------------------------------------------------------
; Globals for Highscorelist
; ------------------------------------------------------------------------
Global MaxHighscore=100
Global HighScore_maxlinewidth,HighscoreCount
Dim HighscoreNames$(100)
Dim HighscoreGames%(100)
Dim HighscoreResults%(100)
Dim Highscore_linewidth(100) ;for TextObj linewidth creation
; ------------------------------------------------------------------------
; PUBLIC FUNCTION: CREATE HIGHSCORELIST TEXTSTRING
; ------------------------------------------------------------------------
Function HUD_HighscoreCreateTxt$(width%, RankChars=4, GamesChars=4, ScoreChars=8)
Local i%, Flag%
For i=MaxHighscore To 1 Step -1
HighscoreCount=i
If HighscoreResults(i)<>0 Then Exit
Next
HighScore_maxlinewidth=width
For i=0 To HighscoreCount
Highscore_linewidth(i)=width%
Next
txt$="Highscores:"+Chr$(13)
For i=1 To HighscoreCount
Flag=0
If HighScoreResults(i)=HighScoreResults(i-1) Then Flag=1
If Flag=0
txt$=txt$+Right$(String$(" ",RankChars)+Str$(i),RankChars)
Else
txt$=txt$+String$(" ",RankChars)
EndIf
If GamesChars=0
txt$=txt$+"~ "+HighScoreNames$(i)+"§"+Chr$(ScoreChars)+Right$(String$(" ",ScoreChars)+Str$(HighScoreResults(i)),ScoreChars)+" "+Chr$(13)
Else
txt$=txt$+"~ "+HighScoreNames$(i)+"§"+Chr$(ScoreChars+GamesChars)+Right$(String$(" ",GamesChars)+Str$(HighScoreGames(i)),GamesChars)+Right$(String$(" ",ScoreChars)+Str$(HighScoreResults(i)),ScoreChars)+" "+Chr$(13)
EndIf
Next
Return txt$
End Function
And this is then worked out in SC_RenderVertices()
Well ... better continue to find what I'm doing wrong ...
Bye
[edit] Maybe I should explain what ~ and § are for.
~ is changed by SC_RenderVertices to a dot ( . ) This way Players can use . in their name for Initials - otherwise you would have to check that after the name input and disallow.
§ passes how many chars are left in the line - so x can be adjusted in SC_RenderVertices ... right margin minus count * NumMaxwidth ...