Saturday, July 30, 2016

Yes, Apple, I did it

Yes, I bought it and it is absolutely awesome. Thanks to Stieve for his awesome input to pleasent work!
Really lovely thing












Maximum resolution reachable through Xcode









//
//  main.cpp
//  Resolution
//
//  Created by Сергей Кривонос on 28.07.16.
//  Copyright © 2016 Сергей Кривонос. All rights reserved.
//

#include <iostream>
#include <CoreGraphics/CoreGraphics.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    auto mainDisplayId = CGMainDisplayID();
    
    std::cout << "Current resolution was "
    << CGDisplayPixelsWide(mainDisplayId) << 'x'
    << CGDisplayPixelsHigh(mainDisplayId) << std::endl
    << "Supported resolution modes:";
    
    auto modes = CGDisplayCopyAllDisplayModes(mainDisplayId, nullptr);
    auto count = CFArrayGetCount(modes);
    CGDisplayModeRef mode;
    for(auto c=count;c--;){
        mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(modes, c);
        auto w = CGDisplayModeGetWidth(mode);
        auto h = CGDisplayModeGetHeight(mode);
        std::cout << std::endl << w << 'x' << h;
    }
    CGDisplaySetDisplayMode(mainDisplayId, mode, nullptr);
    std::cout << " is the selected top one." << std::endl;
    std::cin.get();
    return 0;

}





Do not forget to add CoreGriphics and CoreFoundation frameworks through project setting.






Enjoy!



You know what? Apple even supports higher resolution the was announced!


Current resolution was 1440x900
Supported resolution modes:
640x480
800x600
1024x768
1280x800
1440x900
2048x1280
1152x720
2304x1440 << this was announced

2560x1600 is the selected top one.











full size picture here:
http://d64i.imgup.net/2016-07-305b57.png

11 comments:

  1. I don't understand how did you do that!

    ReplyDelete
    Replies
    1. I've made new video for you. The page have been updated.

      Delete
  2. You can try it by yourself. Just create new console c++ project, put there my code and do not forget to add CoreGriphics framework through project settings.

    ReplyDelete
    Replies
    1. Do you have some guidance, step by step, how to make it work. I dont have any experience with xcode and it is difficult to understand.

      Delete
    2. I've made new video for you. The page have been updated.

      Delete
  3. Is there any guide how to do this? Step by step.

    ReplyDelete
    Replies
    1. I've made new video for you. The page have been updated.

      Delete
    2. I've tried
      https://postimg.org/image/4rnfr9q2d/
      but process failed.

      Delete
    3. Hi Pavle,
      On the page where you typed program name choose C++ instead of Swift.
      Regards

      Delete
  4. It passed https://postimg.org/image/c36f72g91/
    But, how can I change the resolution of my macbook?

    Sorry about the questions, but I'm not a programmer od developer :D.

    ReplyDelete
    Replies
    1. Congratulations! There is the output on your screenshot: https://s9.postimg.org/3q553mi1r/2016_10_10_21_36_10.png
      This mean you had top resolution already. Probably this is not retina display.
      Best solution here is to recycle your computer as I mentioned here http://specialmeaning.blogspot.com/2016/05/apple-please-sorry.html
      Good luck!

      Delete