How to create a cc.LayerColor?

How to create a cc.LayerColor?
0

#1

Hi!

I’m trying to convert my project using Cocos Creator, which seems to be a great tool, thanks for making this possible!

However, I’m having some troubles using ‘simple’ components like cc.LayerColor: how can I create one using Cocos Creator?

Also, all exemples are using black backgrounds, including browser borders, and I want all to be white => is there any way to change the default settings, to have:

  • preview display white borders ?
  • generated index.html use my own preferences, instead of having to modify it at every build?

Thank you!


#2

Found some answers, putting them here in case someone else is interrested.

After some digging (by the way, tutorial is great, as is doc in general, including invaluable API reference: http://cocos2d-x.org/docs/api-ref/creator/v0.71/), it seems there is no more layer in Cocos Creator.

I didn’t found drawing primitives, like drawRect, so how are we supposed to draw simple stuff like lines, circles, rectangles?

About modifying background color, this does the trick (it modify the color used when clearing screen):
cc.director.setClearColor(cc.Color.WHITE);

About the last part of my question, I didn’t found where are located the templates used by Cocos Creator (I’m using Mac Version).

If someone have any idea, I would love to know.

Thanks.


Daniel


#3

hi @cocosdan. Do you know how to change resolution policy in Cocos Creator? I cannot find the option to change it editor and files. Thanks.


#4

Modify the properties of Canvas in the Inspector (design resolution, fit height and fit width).

It is fully explained here:
http://cocos2d-x.org/docs/editors_and_tools/creator-chapters/ui/multi-resolution/#use-canvas-component-in-the-scene


Daniel


#5

I try to apply fit height and fit width but the device screen will have visible border. There is no way to cover the entire screen.


#6

Did you tried to put your actual device screen size into main canvas design resolution?
(it is 960x640 by default, but you can put the values you want)

Daniel


#7

Yes, I did change the value. I don’t think it help either. There are too many types of devices out there with different screen size. For example, iPhone 5 with longer screen size will have black border space.

Actually I am looking for exact_fit to fill all the screen to remove the border space but there is no option for this.


#8

The possibility to modify the predefined templates will be provided in v1.0.


#9

@pandamicro when will v1.0 be released? Is there somwehere a roadmap? Would be nice to know, what is planned in which timeframe.


#10

Thanks! Can’t wait for that. Cocos Creator is really nice to use :smile:


#11

The english roadmap: Cocos Creator RoadMap - UPDATED thru 11/2016

@logidzk Thank you for your support