Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 highscore page scrolling?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
chopperdudes




PostPosted: Wed Nov 19, 2008 12:01 am   Post subject: highscore page scrolling?

i'm making a highscore page for my game i'm making. all highscore values are kept in a file, and are displayed when the user hits the highscore button on the main menu.

however, as opposed to being only able to see teh top 10 per say, i want to be able to display the whole list of highscores, therefore requiring a vertical scroll bar typa thing, where the names will scroll up/down just as how the internet page scrolls when you drag the scroll on the side of your page. i do want to output those in a nice graphical way so turing's textboxes are out of the question.

i have a few ideas right now, no code as of yet.
i can output all the text with fancy fontIDs and stuff onto an offscreenwindow, then create a picture from that. and then by detecting the mouse movements if it was clicked inside the scroll bar, position the picture according to that. the taller the picture, the shorter the scroll bar.

is this the best way to do this? or is there a better way? any suggestions guys?

thx
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Nov 19, 2008 12:20 am   Post subject: RE:highscore page scrolling?

If you want scrolling, then it sounds like the image might have to be taller than the display window -- so you might have trouble generating that image.

You could just draw the text as needed, without caching in images.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
copthesaint




PostPosted: Wed Nov 19, 2008 8:25 am   Post subject: Re: highscore page scrolling?

This may help you. It should give you an idea for how to do this

code:
var chars : array char of boolean
var y := -500
var fnt1 := Font.New ("Ariel:18x12")
loop
    Input.KeyDown (chars)
    if chars (KEY_DOWN_ARROW) then
        if y < 50 then
            y += 5
        end if
    end if
    if chars (KEY_UP_ARROW) then
        if y > -500 then
            y -= 5
        end if
    end if
    Font.Draw ("name1",50,y+450,fnt1,black)
    Font.Draw ("name2",50,y+350,fnt1,black)   
    Font.Draw ("name3",50,y+250,fnt1,black)
    Font.Draw ("name4",50,y+150,fnt1,black)
    Font.Draw ("name5",50,y+50,fnt1,black)
    View.Update
    delay (100)
    cls
end loop


same can be done with more than text
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: