Cocos2d-x Desktop Game Port

Hi I am trying to port my games to win32 with mouse and keyboard support and change the display according to resolutions the monitor can support.

Any idea as to how I would go about doing it using cocos2d-x 2.2.x ot 3.x.

Thanks…

:slight_smile:

I’m not sure I follow…you can check the display size and base your window settings on that.

I’d almost say that 1024 x 768 is a pretty good landscape resolution. Monitor have supported this for a very long time. Could use an iPad 1 or 2 as a testing device for UI as they are 1024 x 768 resolution. :smile:

A lot of desktop games just take over the whole screen. I think this is only a good idea if your game warrants it. Most games, I don’t think do.

All windows desktop games use fullscreen.

And what about mouse and keyboard input?? . :expressionless:

I know lots of games that don’t take over the full screen.

What about the events? Cocos2d-x v3 has these events. Mouse is the same as touch, so no change. Keyboard you would need to add. Perhaps maybe the easiest is adding a flag that gets set if running Windows that adds the keyboard events.

Maybe I don’t understand what you are asking?

Well if not full screen how to include keyboard and mouse input, especially right mouse click?? I knw the left mouse click is equal to a tap.

thanks :slight_smile:

You’ll want to create a mouse listener. You can still use the touch listeners for primary click. EventListenerMouse::create() to get listener that you can attach onMouse[Down|Move|Up] handlers that provide a EventMouse as the sole parameter. If you look at EventMouse you’ll find getMouseButton() to determine which button was pressed/moving/released (0 - left, 1 - middle, 2 - right).

@stevetranby: Thanks. Will this work for 2.2.x ??? :slight_smile:

@slackmoehrle: Got the keyboard working thanks :wink: