Hi,
I am new to Cocos C++. I have been using App Game Kit 2 previously and have now ported my C++ code across to Cocos. I hope to stick with Cocos from now on.
Although I have an issue.
My monitor is set at 1920x1080. I have a white background JPEG which is 1920x1080.
In AGK2, I display this image at position 0,0 (top left hand corner) and it fills my whole screen.
In Cocos (when I centre it), it seems to be smaller and it is displayed with black borders around it? i.e. it does not fill the screen.
My resolution is set as:
static cocos2d::Size designResolutionSize = cocos2d::Size(1920, 1080)
And I am in full screen mode:
glview = GLViewImpl::createWithFullScreen(“CocosGame”)
I get the screen size as:
Director::getInstance()->getVisibleSize()
and as expected it returns Size.width=1920 and Size.height=1080
I get the origin as:
Director::getInstance()->getVisibleOrigin()
and again as expected it returns Vec2(0, 0)
I set the x position as:
size.width / 2 + origin.x
and y position as:
size.height / 2 + origin.y
So basically I do:
setxy(size.width / 2 + origin.x, size.height / 2 + origin.y)
which translates to:
sprite->setPosition(Vec2(x, y))
This should place the JPEG in the middle of the screen and fill out the whole display, or am I wrong?
I am literally running my code almost as the HelloWorldScene template.
Anyone got an idea?