Java Game Development – 16 – Comparing Display Modes

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

30 responses to “Java Game Development – 16 – Comparing Display Modes”

  1. ishan srivastava Avatar

    why tf did he write getCurrentDisplayMode when he could use vc.getDisplayMode()??

  2. Dan Fulea Avatar

    In 2nd and 3rd if statements should be || instead of &&.

  3. Daniel Grooms Avatar

    +RealityInUse from my experience in C++ (I'm not sure if it's for the same reason in Java), you can't compare pointers with boolean comparisons. The display mode variables are just pointers to an allocation of the information that is being used, thus they require an entire method to be compared.

  4. RealityInUse Avatar

    Why write that method…? Why not just use "dm1.equals(dm2)"?

  5. pon33villin Avatar

    A major part of watching other people program is knowing what he's taking from the API and what he's declaring himself and using throughout. You just have to focus and keep track of things that are named the same thing.

    I'm assuming you've been through the beginning tutorials and most of the intermediate ones?

  6. alexander dingwall Avatar

    I feel like I'm just copying him and not taking any of it in :/

  7. fuj1n Avatar

    That only checks if they are the exact same instance, which I would not think they are, it's just like comparing two strings, where you use the .equals() instead of ==

  8. Robert Lowther Avatar

    I'm confused, why did you build the getCompatibleDisplayModes() method and then usw "vc.getDisplayModes()" in the findFirstCompatibleMode() method. I think that maybe you are just trying to make my head explode by writing methods you don't need and then not even having the courtesy to use them. Aside from that though, I love your videos and they are really helping me.

  9. Dara McMahon Avatar

    Dunno why it is, but I'm getting an error for the
    findFirstCompatibleMode(etc.).
    It says it needs to return a DisplayMode.
    I have, as far as I can tell, copied Bucky to the letter, and so I'm uncertain what is going wrong. XD
    Anyone care to help?

  10. Adjotur Avatar

    return type

  11. Chris Harris Avatar

    I would of just used the equals method inside the DisplayMode object. Just check the source code that goes along with this object, it does all the stuff that is required for two DisplayMode objects to be equal.

  12. robertkos3 Avatar

    Why don't use goodModes[y].equals(modes[x] insteed your's?

  13. BGReflexGaming Avatar

    public boolean displayModesMatch (DisplayMode d1, DisplayMode d2) {
    if (d1.getWidth() != d2.getHeight() || d1.getHeight() != d2.getHeight() || d1.getBitDepth() != d2.getBitDepth() || d1.getRefreshRate() != d2.getRefreshRate())
    return false;
    return true;
    }

  14. Edgar Fajardo Avatar

    Why did you write DisplayMode right before certain methods like getCurrentDisplayMode()?

  15. zeroh729 Avatar

    my youtube window was minimized half my screen
    trying to scroll down to read the comments, the video keeps on pausing
    didnt realize
    i was trying to scroll buckys codes ._.

  16. Mike Wang Avatar

    you know you can just do

    return (d1.getWidth() == d2.getWidth() && d1.getHeight() == d2.getHeight())
    && (d1.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI
    || d2.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI
    || d1.getBitDepth() == d2.getBitDepth())
    && (d1.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN
    || d2.getBitDepth() == DisplayMode.REFRESH_RATE_UNKNOWN
    || d1.getRefreshRate() == d2.getRefreshRate());

  17. Nikita coolings Avatar

    not much… theres built in methods that do that…

  18. Alexander Evans Avatar

    Think of how many more tutorials that would require…

  19. oddRaven Avatar

    In most games the screen adjust automatically to the native screen resolution and users can change it to their preferred resolution.

  20. pabloelpopstar Avatar

    cant you just leave the screen as it is and let the user change it with in-game options like in normal games? It's easier I think.

  21. pabloelpopstar Avatar

    just force the god damn screen to 32 bit and 800×600 resolution. Damn anything else!

  22. Sahil Arora Avatar

    Darde Disco @thenewboston

  23. Stroke Avatar

    i feel like im actually learning something for once

  24. unern Avatar

    No, they don't necessarily have to be equal to match each other.
    Example: If the two display modes are equal, except that m1 has unknown refresh rate, while m2 has refresh rate = 60, then m1.equals(m2) returns false, but the method made in this video would return true.

  25. MrDinomite89 Avatar

    Wow only 18,000 views? guess we are down to the people that are really into this

  26. John Wilkinson Avatar

    Probably. But if he had somebody would ask "couldn't you have done it THIS way?"

  27. JohnMichaelFFS Avatar

    couldn't you have done if(m1.equals(m2)) { return true; } else {return false} ?

  28. Jared Jeyaretnam Avatar

    @jaredjeya seems I was right – both of them!

Leave a Reply

Your email address will not be published. Required fields are marked *