CWinCtrlRender¶
Script: RENDER
It is a control for the Render Texture.
When the control is generated, generates the camera together.
Objects rendered on the camera is drawn.
Note
if you have loaded resources, you need to delete them when you close window.
If you forget to delete them,your application memory will leak.
Callbacks arriving at :class:`CWindowBase<CWindowBase>`
void onClick(CWinCtrlBase cCtrl)
void onHold(CWinCtrlBase cCtrl)
void onBeginDrag(CWinCtrlBase cCtrl,Vector2 pos)
void onDrag(CWinCtrlBase cCtrl,Vector2 pos,Vector2 dragVelocity)
bool onDragRender(CWinCtrlBase cCtrl,Transform transform)
void onDrop(CWinCtrlBase cCtrl,CWindowBase cDragWindow,CWinCtrlBase cDragCtrl)
-
class CWinCtrlRender
¶ Functions / Properties
-
Camera
camera
{ get; }¶ you can get the camera to which the rendering texture is assigned. Access when you want to customize the camera position and angle.
Note
Be careful not to create a conflict between the layer settings of the drawing object and the camera.Also, if you can have multiple RENDER controls on the screen at the same time, you must assign them with care to avoid duplicate layer settings in each RENDER.
Example of use
-
Camera
// get control
public override void onCreate() {
CWinCtrlRender rdAvatar = find<CWinCtrlRender>(RENDER_AVATAR);
// get camera
Camera camera = rdAvatar.camera;
// set display layer.
camera.cullingMask = (int) e_Layer.OwnPlayer;
// set camera position and angle.
camera.transform.position = new Vector3(0f,0.85f,0f);
camera.transform.rotation = Quaternion.Euler(new Vector3(0f,180f,0f));
GameObject goAvatar = LoadAvatar();
// Sets the layer of game objects to render (Make Same as Camera).
Utility.setLayer(goAvatar,e_LayerId.OwnPlayer);
}
// click callback
override protected void onClick(CWinCtrlBase cCtrl) {
switch (cCtrl.id) {
case RENDER_AVATAR:
break;
}
}
// hold callback
override protected void onHold(CWinCtrlBase cCtrl) {
switch (cCtrl.id) {
case RENDER_AVATAR:
break;
}
}