Home > other >  Excuse me, how to use lua in a layer to add a red line?
Excuse me, how to use lua in a layer to add a red line?

Time:09-23

The local glNode=gl. GlNodeCreate ()
GlNode: setContentSize (cc. The size (winSize. Width, winSize. Height))

GlNode: setAnchorPoint (cc) p (0.5, 0.5))
The local function primitivesDraw (transform, transformUpdated)
Gl. Our lineWidth (10.0)
Cc. DrawPrimitives. DrawColor4B,0,0,255 (255)
Cc. DrawPrimitives. DrawLine (VisibleRect: leftBottom (), VisibleRect: rightTop ())
End
GlNode: registerScriptDrawHandler (primitivesDraw)
Self. M_pBG: addChild (glNode, 99)
GlNode: setPosition (winSize. Width/2, winSize height/2)


Reference to lua_text code inside, but no horizontal lines appear in the results,
Why is my code, please?
At the same time want to ask next, gl. GlNodeCreate () the use of the function whether need to add other require
GlNode: registerScriptDrawHandler () the registerScriptDrawHandler what role??

His own ideas for two days, or can't, can only refer to you

CodePudding user response:

If you lack the require, the code is run up, can run up to now, what did that don't need to require,

Self. M_pBG displayed this thing? If none of the parent Node, the Node certainly couldn't see,
You'd better output log look at bai
  • Related