zoukankan      html  css  js  c++  java
  • Unity3D 二 GUI高级控件 2.1 Label控件

    //接收外部赋值字符串
    var str :String;
    //接收外部赋值贴图
    var imageTexture : Texture;
    //贴图宽度
    private var imageWidth : int;
    //贴图高度
    private var imageHeight :int;
    //当前屏幕高度
    private var screenWidth :int;
    //当前屏幕宽度
    private var screenHeight :int;

    function Start()
    {
    //得到屏幕宽高
    screenWidth = Screen.width;
    screenHeight = Screen.height;
    //得到图片宽高
    imageWidth = imageTexture.width;
    imageHeight = imageTexture.height;
    }

    function OnGUI ()
    {
    //将文字内容显示在屏幕中
    GUI.Label(Rect(100, 10, 100, 30), str);
    GUI.Label(Rect(100, 40, 100, 30), "当前屏幕宽:" + screenWidth);
    GUI.Label(Rect(100, 80, 100, 30), "当前屏幕高:" + screenHeight);
    //将贴图显示在屏幕中
    GUI.Label(Rect(100, 120, imageWidth, imageHeight),imageTexture);
    }

  • 相关阅读:
    C#发送邮件
    C# MD5加密
    html实现艺术字
    sql日期转换比较问题
    web 抓取
    NHibernate主要数据操作方法
    写日志
    备忘 sql分页
    自我介绍
    企业级应用和互联网应用的区别
  • 原文地址:https://www.cnblogs.com/love0o/p/3066438.html
Copyright © 2011-2022 走看看