Wiki HUD example

Can anyone give me a working HUD example !!!

I created an example: http://cocos2d-x.org/wiki/How_To_Create_A_HUD

I am getting error in the wiki code !!!

You should compare the release notes for 3.0 and 3.1 and see why.

This code is 3.0 and something changed in 3.1

I know, it is a very easy fix, but did you really even try and figure out your error?

I’ll update the Wiki entry Monday.

had a look…found nothing on net…
well will surely look in release notes…

I’ll give you a hint. Matrix and Vector2 were renamed in 3.1

Surprise…i am using cocos2d-x V 3.0…and these problems are occuring in V 3.0…

Glad you fixed it.

Could you update your link? It’s broken

I’m interesting in how to make the position of UI elements fixed and not depending on camera position

You can download the old wiki:

http://docs.cocos2d-x.org/wiki.tar.gz

I’ve ported your example in newer version but that doesn’t do what I need. Labels still anchored in World space instead of Screen. When I moving the camera label moves too. I wanted to fix label position to keep it at the screen independently on current camera position

The maximum I came up with is

void Scene::update(float delta) { Node::update(delta); _hud->setPosition(_defaultCamera->getPosition()); }

Reposition hud in every tick. So-so approach

That works but I think not the best approach.
What kind of game are you making?

I’m making an open world tile-based game. I want to show what position of player is now at the left top corner of the screen. My player (sprite) is moving onTouch and I have a component class FollowTarget : public cocos2d::Component that accepts a Node*. In update it updates this _owner position according to given node. I add that component to _defaultCamera of my scene. So when moving my player it automatically moves my camera