CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2012
    Posts
    15

    Question Making a "list box"

    I want to make something like this for a game:

    Name:  VwXwJ.jpg
Views: 108
Size:  33.0 KB

    It is a "list box" that has 2 scroll buttons (scroll bar not needed). One button push, "scrolls" the list one entry.

    Needs to run crossplatform (windows, linux).

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Making a "list box"

    It all depends on what renderer you are using for your graphics.
    Are you using plain OpenGL?
    Are you using some game framework?
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  3. #3
    Join Date
    Oct 2012
    Posts
    15

    Re: Making a "list box"

    I am using SDL.

    Was thinking to make a stl::list with all possible entries and display only a part of them. When I click one of the scroll buttons I make the corresponding edge element "invisible" and add the next one to the list.

    Any other ways? Any libraries already made?

  4. #4
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Making a "list box"

    Quote Originally Posted by krs0 View Post
    I am using SDL.

    Was thinking to make a stl::list with all possible entries and display only a part of them. When I click one of the scroll buttons I make the corresponding edge element "invisible" and add the next one to the list.
    First, the data structure you use to store the elements should have little, if anything to do with how you want to display the elements. Whether it is a list, map, vector, or what have you, it shouldn't be tightly coupled with the UI. Otherwise you have business logic intertwined with display logic, and that type of design is hard to maintain and update.

    Before deciding on what UI library to use, please read up on the Model-View-Controller design pattern.

    http://en.wikipedia.org/wiki/Model-view-controller

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; October 16th, 2012 at 03:47 AM.

  5. #5
    Join Date
    Oct 2012
    Posts
    15

    Re: Making a "list box"

    The concepts are familiar to me. The problem I have is putting them into practice .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured