Thread: Sliders on Interfaces

Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 31
  1. #21  
    Registered Member

    Join Date
    Feb 2010
    Posts
    3,253
    Thanks given
    1,145
    Thanks received
    909
    Rep Power
    2081
    Quote Originally Posted by Suic View Post
    i understand that, altho i don't see anything that could be done much better in the code currently(other than making the field private and using getters/setters instead which i already did)

    edit: i do appreciate constructive criticism but regarding ur factory method suggestion im just saying that in this case it wouldn't really give me any adventages.
    No immediate advantages. If you needed to extend it you could name it. If you wanted to limit object creation you could use a single or two static sliders instead of constructing one everytime draw instance is called. Granted it probably isn't a significant bottleneck but if you can get any advantage it should be taken really. You could cache them too.

    There are probably way more ideas i've overlooked here too that would be better than mine.

    Another advantage you could use it to reject creation of an object when an invalid parameter is given, for example what if you do not want a default over 100?
    Reply With Quote  
     

  2. #22  
    nice


    Join Date
    Jul 2014
    Posts
    740
    Thanks given
    382
    Thanks received
    562
    Rep Power
    4239
    Quote Originally Posted by Fire Cape View Post
    No immediate advantages. If you needed to extend it you could name it. If you wanted to limit object creation you could use a single or two static sliders instead of constructing one everytime draw instance is called. Granted it probably isn't a significant bottleneck but if you can get any advantage it should be taken really. You could cache them too.

    There are probably way more ideas i've overlooked here too that would be better than mine.

    Another advantage you could use it to reject creation of an object when an invalid parameter is given, for example what if you do not want a default over 100?
    'If you wanted to limit object creation you could use a single or two static sliders instead of constructing one everytime draw instance is called. '
    huh? im not constructing a slider everytime drawInterface() is called? it's literally constructed once and that is the addSlider() method when u create the interface, all preloaded.
    also in terms of extending, theres really nothing to extend, minValue, maxValue, defaultValue is literally all the properties a slider would have, im using the 2 sprites aswell so it can be customized, so theres really no point in extending it now.

    'Another advantage you could use it to reject creation of an object when an invalid parameter is given, for example what if you do not want a default over 100?'
    why would i have something like that(i understand it was just an example) but something like this definately shouldn't be an invalid parameter, what i can do is reject if null is passed as a parameter for the sprites for example.
    Reply With Quote  
     

  3. #23  
    Registered Member

    Join Date
    Feb 2010
    Posts
    3,253
    Thanks given
    1,145
    Thanks received
    909
    Rep Power
    2081
    Quote Originally Posted by Suic View Post
    'If you wanted to limit object creation you could use a single or two static sliders instead of constructing one everytime draw instance is called. '
    huh? im not constructing a slider everytime drawInterface() is called? it's literally constructed once and that is the addSlider() method when u create the interface, all preloaded.
    also in terms of extending, theres really nothing to extend, minValue, maxValue, defaultValue is literally all the properties a slider would have, im using the 2 sprites aswell so it can be customized, so theres really no point in extending it now.
    .
    Code:
     widget.widgetSlider = new WidgetSlider(minValue, maxValue, defaultValue, background, handle);
    This is called when addSlider is called. Everytime you call addSlider you are constructing a new WidgetSlider.

    Quote Originally Posted by Suic View Post
    'Another advantage you could use it to reject creation of an object when an invalid parameter is given, for example what if you do not want a default over 100?'
    why would i have something like that(i understand it was just an example) but something like this definately shouldn't be an invalid parameter, what i can do is reject if null is passed as a parameter for the sprites for example.
    Yeah see you're getting the idea now.
    Reply With Quote  
     

  4. #24  
    nice


    Join Date
    Jul 2014
    Posts
    740
    Thanks given
    382
    Thanks received
    562
    Rep Power
    4239
    Quote Originally Posted by Fire Cape View Post
    Code:
     widget.widgetSlider = new WidgetSlider(minValue, maxValue, defaultValue, background, handle);
    This is called when addSlider is called. Everytime you call addSlider you are constructing a new WidgetSlider.



    Yeah see you're getting the idea now.
    yes, but im calling addSlider() only once per slider and thats all loaded into memory on startup, so 10 different interfaces with a slider component each would be 10 calls to addSlider(), thats on startup not runtime.
    Reply With Quote  
     

  5. #25  
    Registered Member

    Join Date
    Feb 2010
    Posts
    3,253
    Thanks given
    1,145
    Thanks received
    909
    Rep Power
    2081
    Quote Originally Posted by Suic View Post
    yes, but im calling addSlider() only once per slider and thats all loaded into memory on startup, so 10 different interfaces with a slider component each would be 10 calls to addSlider(), thats on startup not runtime.
    Oh really? This is one of those things I meant to clarify earlier lol my bad, I couldn't remember if it was drew when the interface was required.
    Reply With Quote  
     

  6. #26  
    nice


    Join Date
    Jul 2014
    Posts
    740
    Thanks given
    382
    Thanks received
    562
    Rep Power
    4239
    Quote Originally Posted by Fire Cape View Post
    Oh really? This is one of those things I meant to clarify earlier lol my bad, I couldn't remember if it was drew when the interface was required.
    yeah , if it was constructed on every draw call that would of been awful, it's only drawn each draw call but thats obvious, every component is, the handle method is also only called when necessary.
    Reply With Quote  
     

  7. #27  
    Registered Member
    rebecca's Avatar
    Join Date
    Aug 2017
    Posts
    1,071
    Thanks given
    862
    Thanks received
    915
    Rep Power
    5000
    this is great gj sooic
    Reply With Quote  
     

  8. #28  
    Extreme Donator

    Benneh's Avatar
    Join Date
    Nov 2015
    Posts
    199
    Thanks given
    133
    Thanks received
    102
    Rep Power
    464
    Great job man
    Quote Originally Posted by Corey View Post
    Vouch for Benneh

    Worked with him for a month. He's professional and always on time with posts, always interested in how the server is doing and how he can can improve and help in any way.
    Reply With Quote  
     

  9. #29  
    ¯\_(ツ)_/¯


    Join Date
    Jul 2014
    Posts
    1,803
    Thanks given
    928
    Thanks received
    550
    Rep Power
    299
    Been done & released before but nice snippet
    Reply With Quote  
     

  10. #30  
    Banned

    Join Date
    Jun 2019
    Posts
    203
    Thanks given
    99
    Thanks received
    44
    Rep Power
    0
    Quote Originally Posted by Hitten View Post
    Been done & released before but nice snippet
    He litterally said that in the main post, he improved what was released.
    Reply With Quote  
     

  11. Thankful user:


Page 3 of 4 FirstFirst 1234 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 5
    Last Post: 01-02-2009, 05:33 AM
  2. Replies: 13
    Last Post: 05-10-2008, 12:58 AM
  3. Replies: 17
    Last Post: 04-28-2008, 01:10 PM
  4. Fading on interfaces / displays and such
    By Clienthax in forum RS2 Client
    Replies: 15
    Last Post: 04-12-2008, 03:02 PM
  5. Replies: 30
    Last Post: 02-10-2008, 04:48 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •