SKCameraNode positioning on Mac: non-retina vs retina - macos

I have a game that I’m porting from iOS to MacOS. On iOS, everything functions as it should on retina and non-retina devices. On Mac, it’s a different story.
I have two class properties: upperCameraPos and lowerCameraPos
The game is in a window and the scene is twice the height of this window’s content view (SKView). When the game starts. the camera node is positioned at lowerCameraPos, revealing the bottom half of the scene. When a button is pressed, SKAction’s moveToPoint: method is used to scroll the scene up, revealing the top half. On retina and 4K Macs, this works as expected.
However, on non-retina Macs (tested on late ’07 iMac & late ’08 MacBook), the same code for setting the camera’s initial position does not reveal the lower half of the scene, but rather shows the middle of the scene (which is the camera's default position).
I’ve done a considerable amount of searching and haven’t found any explanation for this. Does anyone know if there are any issues between retina & non-retina when positioning a camera node in a scene on Mac?

I figured out what I was doing wrong. I had the scene's scale mode set to SKSceneScaleModeAspectFill. After changing the scale mode to SKSceneScaleModeResizeFill, the camera node now scales to the correct parts of the scene regardless of whether the screen is retina or non-retina.

Related

Android OpenGL ES rotating screen

I use Gaussian blur to achieve the lighting effect.
On android, after rotating the screen, the first half of the screen is normal, and the second half of the screen is jagged.
This problem has also appeared on some iOS phones.
I don't know what the problem is.
I used fbo, texture buffering, depth buffering, and stencil buffering, and I recreated them with new dimensions each time I rotated the screen.
Ask what is the problem?

Set the screen for Universal devices ( iPhone and iPad )

I made a game. I want to use it on iPhone and iPad(Universal game). I set screen 640x1136 in gamescene.sks file. When I play the game on all of iPhone, screen is seems perfect. But when I play on iPad, game screen looks bigger than iPad screen. How can I set screen for iPad?
It all comes down to the scaleMode you are using.
You have 4 options
This first 1 resizes your scene frame, the others keep the scene at the size you specified and scale to fit the screen.
.Resize, as stated, resizes your scene to fit your screen. If your initial scene is 10,10, it will make the scene size 320x480 on an iPhone 4s
.Fill (Default), which keeps the coordinates of your scene the same, but stretches in the x and y direction. If your game was in Landscape, and you design for a 4:3 screen, you will create a fat effect when going to 16x9
.AspectFill, which keeps the aspect ratio the same, but will scale your scene till the furthest borders are hit. If you are in landscape with a 4:3 scene, it will stretch to the left and right borders, making the top and bottom cropped to maintain the ratio.
.AspectFit, which keeps the aspect ratio the same, but will scale your scene till the nearest borders are hit. If you are in landscape with a 4:3 scene, it will stretch to the top and bottom borders, making black borders appear on left and right.
If you want your game to appear the same size on all screens, your best bet is to use .AspectFill, and plan your game around the cropping. (Basically do not put anything important in an area that gets cropped)

How to set orientation for each scene in xCode SpriteKit?

I'm working on a basic game with 3 scenes. The first is the menu (landscaped). From that I choose from sprites between two versions of the game: first is with only portrait (and upside down) orientations, and the other is landscape left or right. In ViewController I use viewWillLayoutSubviews. (I don't know if it's relevant now).
Is it possible to allow only portrait or landscape orientation for different scenes?

Jerky NSScrollView scrolling at certain angles on Yosemite (when using layers)

I have an NSScrollview with a large canvas that can be scrolled and zoomed etc. When I scroll diagonally at an angle of around 20 degrees from vertical it's really jerky (using a track pad.) This jerkiness even continues as the scrolling animates to rest.
All other angles of scroll are buttery smooth - which makes me think it's got something to do with a preference for vertical scrolling (predominant axis scrolling is disabled.)
The effect only seems to happen when I'm using layer backed views.
Anyone know what's going on here?
Thanks
Craig
Confirmed bug in OSX Yosemite (by Apple DTS)

Text blurry when running nonuniversal iPhone app on iPad

Basically I'm trying to retinafy my game
So my application isn't universal, its specifically for the iPhone. I just would like to to also look its best when running on the iPad.
I've created a simple method to load the high resolution images when running on the iPad in scaled 2x mode. Which is working.
However my problem isn't the images. Its my UILabels and UIButtons. When I scale up the text becomes slightly blurry.
So they look fine with 1x scale. Its just 2x scale on the iPad.
Is there property I can set or a way I can redraw the UILabels/UIButtons so that they are more clear?
When an iPhone app is running on an iPad and scaled x2, you can't draw to each individual pixel. It is literally an enlarged 320x480 pixel screen (or 640x960 if you are using an iPad 3 which simulates an iPhone with a retina display).
Hope that helps.

Resources