This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var canvasWidthPx = 640; | |
| var text = "sample text sample text sample text sample text"; | |
| var textWidthPx = context.measureText(text).width; | |
| var charWidthPx = Math.ceil(textWidthPx / text.length); | |
| var nWordInLine = Math.floor(canvasWidthPx / charWidthPx); | |
| var nLine = Math.ceil(text.length / nWordInLine); | |
| var wordHeightPx = 60; | |
| for (var i = 0; i < nLine; ++i) { | |
| var render_text = text.substr(i*nWordInLine, (i+1)*nWordInLine); | |
| context.fillText(render_text, 0, 200+(wordHeightPx*i)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // uGUI Text の Text スクリプトを取得 | |
| var t = GameObject.Find("textbox").gameObject.GetComponent<Text>(); | |
| // レンダリングするテキスト | |
| t.text = "abcdefghijklmnopqrstuvwxyz01234567890"; | |
| // 改行位置等を計算 | |
| var generator = new TextGenerator(); | |
| var rt = t.GetComponent<RectTransform>(); | |
| var size = new Vector2(rt.rect.width, rt.rect.height); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // BEGIN MIT LICENSE BLOCK // | |
| // | |
| // Copyright (c) 2016 dskjal | |
| // This software is released under the MIT License. | |
| // http://opensource.org/licenses/mit-license.php | |
| // | |
| // END MIT LICENSE BLOCK // | |
| var warps = ",)]}、〕〉》」』】〙〗〟’”⦆»‐゠–〜~?!‼⁇⁈⁉・:;/。."; | |
| var hasWarp = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // BEGIN MIT LICENSE BLOCK // | |
| // | |
| // Copyright (c) 2016 dskjal | |
| // This software is released under the MIT License. | |
| // http://opensource.org/licenses/mit-license.php | |
| // | |
| // END MIT LICENSE BLOCK // | |
| using UnityEngine; | |
| [RequireComponent(typeof(Camera))] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private int getFontHeight(GUIStyle style) { | |
| var labelSize = style.CalcSize(new GUIContent("ABC")); | |
| return (int)labelSize.y; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // BEGIN MIT LICENSE BLOCK // | |
| // | |
| // Copyright (c) 2016 dskjal | |
| // This software is released under the MIT License. | |
| // http://opensource.org/licenses/mit-license.php | |
| // | |
| // END MIT LICENSE BLOCK // | |
| private void getProperFontSize(GUIStyle style, int nLines, int textAreaHeight) { | |
| int maxHeight = textAreaHeight / nLines; | |
| int curHeight = getFontHeight(style); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // BEGIN MIT LICENSE BLOCK // | |
| // | |
| // Copyright (c) 2016 dskjal | |
| // This software is released under the MIT License. | |
| // http://opensource.org/licenses/mit-license.php | |
| // | |
| // END MIT LICENSE BLOCK // | |
| using UnityEngine; | |
| public class FpvCamera : MonoBehaviour { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // BEGIN MIT LICENSE BLOCK // | |
| // | |
| // Copyright (c) 2016 dskjal | |
| // This software is released under the MIT License. | |
| // http://opensource.org/licenses/mit-license.php | |
| // | |
| // END MIT LICENSE BLOCK // | |
| using UnityEngine; | |
| [RequireComponent(typeof(Camera))] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // BEGIN MIT LICENSE BLOCK // | |
| // | |
| // Copyright (c) 2019 dskjal | |
| // This software is released under the MIT License. | |
| // http://opensource.org/licenses/mit-license.php | |
| // | |
| // END MIT LICENSE BLOCK // | |
| import bpy | |
| from bpy.props import * | |
| import mathutils |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // BEGIN MIT LICENSE BLOCK // | |
| // | |
| // Copyright (c) 2016 dskjal | |
| // This software is released under the MIT License. | |
| // http://opensource.org/licenses/mit-license.php | |
| // | |
| // END MIT LICENSE BLOCK // | |
| using UnityEngine; | |
| using System.Collections; | |
| using UnityEngine.UI; |