X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
| Revision | 151 (tree) |
|---|---|
| Time | 2016-09-22 05:07:58 |
| Author | |
デバック用コンソール機能のフォントを変更
| @@ -0,0 +1,189 @@ | ||
| 1 | +//! @file d3dgraphics-debugfont.cpp | |
| 2 | +//! @brief D3DGraphics使用フォントデータ格納 | |
| 3 | + | |
| 4 | +//-------------------------------------------------------------------------------- | |
| 5 | +// | |
| 6 | +// OpenXOPS | |
| 7 | +// Copyright (c) 2014-2016, OpenXOPS Project / [-_-;](mikan) All rights reserved. | |
| 8 | +// | |
| 9 | +// Redistribution and use in source and binary forms, with or without | |
| 10 | +// modification, are permitted provided that the following conditions are met: | |
| 11 | +// * Redistributions of source code must retain the above copyright notice, | |
| 12 | +// this list of conditions and the following disclaimer. | |
| 13 | +// * Redistributions in binary form must reproduce the above copyright notice, | |
| 14 | +// this list of conditions and the following disclaimer in the documentation | |
| 15 | +// and/or other materials provided with the distribution. | |
| 16 | +// * Neither the name of the OpenXOPS Project nor the names of its contributors | |
| 17 | +// may be used to endorse or promote products derived from this software | |
| 18 | +// without specific prior written permission. | |
| 19 | +// | |
| 20 | +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | |
| 21 | +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| 22 | +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
| 23 | +// DISCLAIMED. IN NO EVENT SHALL OpenXOPS Project BE LIABLE FOR ANY | |
| 24 | +// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 25 | +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
| 26 | +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
| 27 | +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 28 | +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 29 | +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 30 | +//-------------------------------------------------------------------------------- | |
| 31 | + | |
| 32 | +// フォントデータは "OSASK version 4.7" の物をお借りしています。 | |
| 33 | +// フォントの作成者は 平木敬太郎さん と 聖人(Kiyoto)さん です。 | |
| 34 | +// 元ファイル(newstyle.txt)は KL-01ライセンス で公開されています。 | |
| 35 | +// http://osask.net/ | |
| 36 | +// https://osdn.jp/projects/osask/scm/svn/tree/211/OSAKA/tags/4.7.0/ | |
| 37 | +// | |
| 38 | +// | |
| 39 | +// [1] フォントの形状を 8x16 の2進数で表す(「0:.」「1:*」で表現) | |
| 40 | +// ........ | |
| 41 | +// ...*.... | |
| 42 | +// ..***... | |
| 43 | +// .**.**.. | |
| 44 | +// **...**. | |
| 45 | +// **...**. | |
| 46 | +// **...**. | |
| 47 | +// *******. | |
| 48 | +// **...**. | |
| 49 | +// **...**. | |
| 50 | +// **...**. | |
| 51 | +// **...**. | |
| 52 | +// ........ | |
| 53 | +// ........ | |
| 54 | +// ........ | |
| 55 | +// ........ | |
| 56 | +// | |
| 57 | +// [2] 各行を16進数に変換 | |
| 58 | +// ........ → 00000000 → 0x00 | |
| 59 | +// ...*.... → 00010000 → 0x10 | |
| 60 | +// ..***... → 00111000 → 0x38 | |
| 61 | +// .**.**.. → 01101100 → 0x6C | |
| 62 | +// 〜〜〜〜〜 | |
| 63 | +// ........ → 00000000 → 0x00 | |
| 64 | +// | |
| 65 | +// [3] マクロで配列変数に格納 | |
| 66 | +// SetDebugFontData( DebugFontData[xxx], 0x00, 0x10, 0x38, 0x6C, 〜〜〜〜〜 0x00 ); | |
| 67 | +// | |
| 68 | +// OpenXOPS起動時には逆展開を行い、DirectXおよびOpenGLでテクスチャフォントを生成します。 | |
| 69 | +// | |
| 70 | +// | |
| 71 | +// ※OpenXOPSにおいて、本フォントデータを編集・改変する前提はありません。 | |
| 72 | + | |
| 73 | +#include "d3dgraphics.h" | |
| 74 | + | |
| 75 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 76 | + | |
| 77 | +//! @brief デバック用フォント初期化のためのマクロ | |
| 78 | +#define SetDebugFontData( out16, in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, inA, inB, inC, inD, inE, inF ){\ | |
| 79 | + /*! buffer */\ | |
| 80 | + unsigned char *Data = out16;\ | |
| 81 | + Data[0] = in0; Data[1] = in1; Data[2] = in2; Data[3] = in3;\ | |
| 82 | + Data[4] = in4; Data[5] = in5; Data[6] = in6; Data[7] = in7;\ | |
| 83 | + Data[8] = in8; Data[9] = in9; Data[10] = inA; Data[11] = inB;\ | |
| 84 | + Data[12] = inC; Data[13] = inD; Data[14] = inE; Data[15] = inF;\ | |
| 85 | +} | |
| 86 | + | |
| 87 | +//! @brief デバック用フォント初期化(パラメータの設定) | |
| 88 | +//! @attention この関数を呼び出さないと、デバック用フォント自体が正しく機能しません。 | |
| 89 | +void D3DGraphics::InitDebugFontData() | |
| 90 | +{ | |
| 91 | + SetDebugFontData( DebugFontData[0], 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ); //char 0x20 (' ') | |
| 92 | + SetDebugFontData( DebugFontData[1], 0x00, 0x10, 0x38, 0x38, 0x38, 0x38, 0x38, 0x10, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00 ); //char 0x21 ('!') | |
| 93 | + SetDebugFontData( DebugFontData[2], 0x6C, 0x6C, 0x6C, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ); //char 0x22 ('"') | |
| 94 | + SetDebugFontData( DebugFontData[3], 0x00, 0x6C, 0x6C, 0x6C, 0xFE, 0x6C, 0x6C, 0x6C, 0xFE, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00 ); //char 0x23 ('#') | |
| 95 | + SetDebugFontData( DebugFontData[4], 0x00, 0x10, 0x10, 0x7C, 0xC2, 0xC0, 0xC0, 0x7C, 0x06, 0x06, 0x86, 0x7C, 0x10, 0x10, 0x00, 0x00 ); //char 0x24 ('$') | |
| 96 | + SetDebugFontData( DebugFontData[5], 0x00, 0x00, 0x00, 0x00, 0x61, 0x63, 0x06, 0x0C, 0x18, 0x30, 0x63, 0xC3, 0x00, 0x00, 0x00, 0x00 ); //char 0x25 ('%') | |
| 97 | + SetDebugFontData( DebugFontData[6], 0x00, 0x30, 0x58, 0x50, 0x20, 0x50, 0x56, 0xCE, 0xCE, 0xCC, 0x4C, 0x7A, 0x00, 0x00, 0x00, 0x00 ); //char 0x26 ('&') | |
| 98 | + SetDebugFontData( DebugFontData[7], 0x0C, 0x1C, 0x18, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ); //char 0x27 (''') | |
| 99 | + SetDebugFontData( DebugFontData[8], 0x00, 0x06, 0x0C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00, 0x00, 0x00, 0x00 ); //char 0x28 ('(') | |
| 100 | + SetDebugFontData( DebugFontData[9], 0x00, 0xC0, 0x60, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00 ); //char 0x29 (')') | |
| 101 | + SetDebugFontData( DebugFontData[10], 0x00, 0x00, 0x00, 0x00, 0x44, 0x6C, 0x28, 0xFE, 0x28, 0x6C, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00 ); //char 0x2A ('*') | |
| 102 | + SetDebugFontData( DebugFontData[11], 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0xFC, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ); //char 0x2B ('+') | |
| 103 | + SetDebugFontData( DebugFontData[12], 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00 ); //char 0x2C (',') | |
| 104 | + SetDebugFontData( DebugFontData[13], 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ); //char 0x2D ('-') | |
| 105 | + SetDebugFontData( DebugFontData[14], 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00 ); //char 0x2E ('.') | |
| 106 | + SetDebugFontData( DebugFontData[15], 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00 ); //char 0x2F ('/') | |
| 107 | + SetDebugFontData( DebugFontData[16], 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xD6, 0xD6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 ); //char 0x30 ('0') | |
| 108 | + SetDebugFontData( DebugFontData[17], 0x00, 0x18, 0x18, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, 0x00, 0x00, 0x00 ); //char 0x31 ('1') | |
| 109 | + SetDebugFontData( DebugFontData[18], 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x06, 0x0E, 0x0C, 0x18, 0x30, 0x62, 0xFE, 0x00, 0x00, 0x00, 0x00 ); //char 0x32 ('2') | |
| 110 | + SetDebugFontData( DebugFontData[19], 0x00, 0x7C, 0x86, 0x06, 0x06, 0x06, 0x1C, 0x06, 0x06, 0x06, 0x86, 0x7C, 0x00, 0x00, 0x00, 0x00 ); //char 0x33 ('3') | |
| 111 | + SetDebugFontData( DebugFontData[20], 0x00, 0x04, 0x0C, 0x1C, 0x2C, 0x4C, 0x8C, 0x8C, 0xFE, 0x0C, 0x0C, 0x1E, 0x00, 0x00, 0x00, 0x00 ); //char 0x34 ('4') | |
| 112 | + SetDebugFontData( DebugFontData[21], 0x00, 0x7E, 0x60, 0x60, 0x60, 0x60, 0x7C, 0x06, 0x06, 0x06, 0x46, 0x3C, 0x00, 0x00, 0x00, 0x00 ); //char 0x35 ('5') | |
| 113 | + SetDebugFontData( DebugFontData[22], 0x00, 0x3C, 0x62, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00 ); //char 0x36 ('6') | |
| 114 | + SetDebugFontData( DebugFontData[23], 0x00, 0x7E, 0x46, 0x46, 0x06, 0x0C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 ); //char 0x37 ('7') | |
| 115 | + SetDebugFontData( DebugFontData[24], 0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00 ); //char 0x38 ('8') | |
| 116 | + SetDebugFontData( DebugFontData[25], 0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x06, 0x46, 0x3C, 0x00, 0x00, 0x00, 0x00 ); //char 0x39 ('9') | |
| 117 | + SetDebugFontData( DebugFontData[26], 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x00, 0x00 ); //char 0x3A (':') | |
| 118 | + SetDebugFontData( DebugFontData[27], 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x04, 0x08, 0x00, 0x00 ); //char 0x3B (';') | |
| 119 | + SetDebugFontData( DebugFontData[28], 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00, 0x00, 0x00, 0x00 ); //char 0x3C ('<') | |
| 120 | + SetDebugFontData( DebugFontData[29], 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ); //char 0x3D ('=') | |
| 121 | + SetDebugFontData( DebugFontData[30], 0x00, 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00 ); //char 0x3E ('>') | |
| 122 | + SetDebugFontData( DebugFontData[31], 0x00, 0x00, 0x3C, 0x66, 0x66, 0x06, 0x0C, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 ); //char 0x3F ('?') | |
| 123 | + SetDebugFontData( DebugFontData[32], 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xDE, 0xDE, 0xDE, 0xDC, 0xC0, 0x7C, 0x00, 0x00, 0x00, 0x00 ); //char 0x40 ('@') | |
| 124 | + SetDebugFontData( DebugFontData[33], 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 ); //char 0x41 ('A') | |
| 125 | + SetDebugFontData( DebugFontData[34], 0x00, 0xFC, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00 ); //char 0x42 ('B') | |
| 126 | + SetDebugFontData( DebugFontData[35], 0x00, 0x3C, 0x66, 0xC2, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC2, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00 ); //char 0x43 ('C') | |
| 127 | + SetDebugFontData( DebugFontData[36], 0x00, 0xF8, 0x6C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00, 0x00, 0x00, 0x00 ); //char 0x44 ('D') | |
| 128 | + SetDebugFontData( DebugFontData[37], 0x00, 0xFC, 0x66, 0x60, 0x60, 0x64, 0x7C, 0x64, 0x60, 0x60, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00 ); //char 0x45 ('E') | |
| 129 | + SetDebugFontData( DebugFontData[38], 0x00, 0xFC, 0x66, 0x60, 0x60, 0x64, 0x7C, 0x64, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00 ); //char 0x46 ('F') | |
| 130 | + SetDebugFontData( DebugFontData[39], 0x00, 0x3C, 0x66, 0xC0, 0xC0, 0xC0, 0xC0, 0xDE, 0xC6, 0xC6, 0x66, 0x3E, 0x00, 0x00, 0x00, 0x00 ); //char 0x47 ('G') | |
| 131 | + SetDebugFontData( DebugFontData[40], 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 ); //char 0x48 ('H') | |
| 132 | + SetDebugFontData( DebugFontData[41], 0x00, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, 0x00, 0x00, 0x00 ); //char 0x49 ('I') | |
| 133 | + SetDebugFontData( DebugFontData[42], 0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x00, 0x00 ); //char 0x4A ('J') | |
| 134 | + SetDebugFontData( DebugFontData[43], 0x00, 0xC6, 0xC6, 0xCC, 0xD8, 0xF0, 0xE0, 0xF0, 0xD8, 0xCC, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 ); //char 0x4B ('K') | |
| 135 | + SetDebugFontData( DebugFontData[44], 0x00, 0xF0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00 ); //char 0x4C ('L') | |
| 136 | + SetDebugFontData( DebugFontData[45], 0x00, 0xC6, 0xC6, 0xEE, 0xEE, 0xFE, 0xFE, 0xFE, 0xD6, 0xD6, 0xD6, 0xC6, 0x00, 0x00, 0x00, 0x00 ); //char 0x4D ('M') | |
| 137 | + SetDebugFontData( DebugFontData[46], 0x00, 0xC6, 0xE6, 0xE6, 0xF6, 0xF6, 0xDE, 0xDE, 0xCE, 0xC6, 0xC6, 0xC2, 0x00, 0x00, 0x00, 0x00 ); //char 0x4E ('N') | |
| 138 | + SetDebugFontData( DebugFontData[47], 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 ); //char 0x4F ('O') | |
| 139 | + SetDebugFontData( DebugFontData[48], 0x00, 0xFC, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00 ); //char 0x50 ('P') | |
| 140 | + SetDebugFontData( DebugFontData[49], 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xD6, 0xD6, 0x7C, 0x10, 0x18, 0x0C, 0x00 ); //char 0x51 ('Q') | |
| 141 | + SetDebugFontData( DebugFontData[50], 0x00, 0xFC, 0xC6, 0xC6, 0xC6, 0xC6, 0xFC, 0xF8, 0xCC, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 ); //char 0x52 ('R') | |
| 142 | + SetDebugFontData( DebugFontData[51], 0x00, 0x7C, 0xC6, 0xC0, 0xC0, 0xC0, 0x7C, 0x06, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 ); //char 0x53 ('S') | |
| 143 | + SetDebugFontData( DebugFontData[52], 0x00, 0x7E, 0x5A, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00 ); //char 0x54 ('T') | |
| 144 | + SetDebugFontData( DebugFontData[53], 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 ); //char 0x55 ('U') | |
| 145 | + SetDebugFontData( DebugFontData[54], 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x6C, 0x6C, 0x6C, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 ); //char 0x56 ('V') | |
| 146 | + SetDebugFontData( DebugFontData[55], 0x00, 0xC6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0x7C, 0x7C, 0x6C, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00 ); //char 0x57 ('W') | |
| 147 | + SetDebugFontData( DebugFontData[56], 0x00, 0xC6, 0xC6, 0xC6, 0x6C, 0x6C, 0x38, 0x6C, 0x6C, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 ); //char 0x58 ('X') | |
| 148 | + SetDebugFontData( DebugFontData[57], 0x00, 0x66, 0x66, 0x66, 0x66, 0x7E, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00 ); //char 0x59 ('Y') | |
| 149 | + SetDebugFontData( DebugFontData[58], 0x00, 0xFE, 0x06, 0x0E, 0x1C, 0x18, 0x38, 0x30, 0x70, 0xE0, 0xC0, 0xFE, 0x00, 0x00, 0x00, 0x00 ); //char 0x5A ('Z') | |
| 150 | + SetDebugFontData( DebugFontData[59], 0x00, 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00, 0x00, 0x00, 0x00 ); //char 0x5B ('[') | |
| 151 | + SetDebugFontData( DebugFontData[60], 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00, 0x00, 0x00, 0x00 ); //char 0x5C ('\') | |
| 152 | + SetDebugFontData( DebugFontData[61], 0x00, 0xF0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xF0, 0x00, 0x00, 0x00, 0x00 ); //char 0x5D (']') | |
| 153 | + SetDebugFontData( DebugFontData[62], 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ); //char 0x5E ('^') | |
| 154 | + SetDebugFontData( DebugFontData[63], 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00 ); //char 0x5F ('_') | |
| 155 | + SetDebugFontData( DebugFontData[64], 0x60, 0x70, 0x30, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ); //char 0x60 ('`') | |
| 156 | + SetDebugFontData( DebugFontData[65], 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x7E, 0x00, 0x00, 0x00, 0x00 ); //char 0x61 ('a') | |
| 157 | + SetDebugFontData( DebugFontData[66], 0x00, 0xE0, 0x60, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00 ); //char 0x62 ('b') | |
| 158 | + SetDebugFontData( DebugFontData[67], 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x66, 0xC0, 0xC0, 0xC0, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00 ); //char 0x63 ('c') | |
| 159 | + SetDebugFontData( DebugFontData[68], 0x00, 0x1C, 0x0C, 0x0C, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x7E, 0x00, 0x00, 0x00, 0x00 ); //char 0x64 ('d') | |
| 160 | + SetDebugFontData( DebugFontData[69], 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xFE, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 ); //char 0x65 ('e') | |
| 161 | + SetDebugFontData( DebugFontData[70], 0x00, 0x00, 0x1C, 0x36, 0x30, 0xFC, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00 ); //char 0x66 ('f') | |
| 162 | + SetDebugFontData( DebugFontData[71], 0x00, 0x00, 0x00, 0x00, 0x06, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x0C, 0xC6, 0xC6, 0x7C, 0x00 ); //char 0x67 ('g') | |
| 163 | + SetDebugFontData( DebugFontData[72], 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xFC, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 ); //char 0x68 ('h') | |
| 164 | + SetDebugFontData( DebugFontData[73], 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, 0x00, 0x00, 0x00 ); //char 0x69 ('i') | |
| 165 | + SetDebugFontData( DebugFontData[74], 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x1C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0xCC, 0x78, 0x00 ); //char 0x6A ('j') | |
| 166 | + SetDebugFontData( DebugFontData[75], 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xC6, 0xCC, 0xD8, 0xF0, 0xD8, 0xCC, 0xC6, 0x00, 0x00, 0x00, 0x00 ); //char 0x6B ('k') | |
| 167 | + SetDebugFontData( DebugFontData[76], 0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, 0x00, 0x00, 0x00 ); //char 0x6C ('l') | |
| 168 | + SetDebugFontData( DebugFontData[77], 0x00, 0x00, 0x00, 0x00, 0x00, 0xEC, 0x7E, 0x56, 0x56, 0x56, 0x56, 0xC6, 0x00, 0x00, 0x00, 0x00 ); //char 0x6D ('m') | |
| 169 | + SetDebugFontData( DebugFontData[78], 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0xE6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 ); //char 0x6E ('n') | |
| 170 | + SetDebugFontData( DebugFontData[79], 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 ); //char 0x6F ('o') | |
| 171 | + SetDebugFontData( DebugFontData[80], 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00 ); //char 0x70 ('p') | |
| 172 | + SetDebugFontData( DebugFontData[81], 0x00, 0x00, 0x00, 0x00, 0x00, 0x7A, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0x0C, 0x1E, 0x00 ); //char 0x71 ('q') | |
| 173 | + SetDebugFontData( DebugFontData[82], 0x00, 0x00, 0x00, 0x00, 0x00, 0xD8, 0xEC, 0xCC, 0xCC, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00 ); //char 0x72 ('r') | |
| 174 | + SetDebugFontData( DebugFontData[83], 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0x7C, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 ); //char 0x73 ('s') | |
| 175 | + SetDebugFontData( DebugFontData[84], 0x00, 0x00, 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0C, 0x00, 0x00, 0x00, 0x00 ); //char 0x74 ('t') | |
| 176 | + SetDebugFontData( DebugFontData[85], 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xCE, 0x76, 0x00, 0x00, 0x00, 0x00 ); //char 0x75 ('u') | |
| 177 | + SetDebugFontData( DebugFontData[86], 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0x6C, 0x6C, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 ); //char 0x76 ('v') | |
| 178 | + SetDebugFontData( DebugFontData[87], 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xD6, 0xD6, 0x7C, 0x6C, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00 ); //char 0x77 ('w') | |
| 179 | + SetDebugFontData( DebugFontData[88], 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 ); //char 0x78 ('x') | |
| 180 | + SetDebugFontData( DebugFontData[89], 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0x6C, 0x7C, 0x3C, 0x18, 0x18, 0x30, 0x60, 0x00 ); //char 0x79 ('y') | |
| 181 | + SetDebugFontData( DebugFontData[90], 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0xFE, 0x00, 0x00, 0x00, 0x00 ); //char 0x7A ('z') | |
| 182 | + SetDebugFontData( DebugFontData[91], 0x00, 0x0E, 0x18, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0E, 0x00, 0x00, 0x00, 0x00 ); //char 0x7B ('{') | |
| 183 | + SetDebugFontData( DebugFontData[92], 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 ); //char 0x7C ('|') | |
| 184 | + SetDebugFontData( DebugFontData[93], 0x00, 0xE0, 0x30, 0x30, 0x30, 0x30, 0x1C, 0x30, 0x30, 0x30, 0x30, 0xE0, 0x00, 0x00, 0x00, 0x00 ); //char 0x7D ('}') | |
| 185 | + SetDebugFontData( DebugFontData[94], 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ); //char 0x7E ('~') | |
| 186 | + SetDebugFontData( DebugFontData[95], 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ); //char 0x7F ('') | |
| 187 | +} | |
| 188 | + | |
| 189 | +#endif | |
| \ No newline at end of file |
| @@ -57,6 +57,10 @@ | ||
| 57 | 57 | //ptextsprite = NULL; |
| 58 | 58 | pxmsfont = NULL; |
| 59 | 59 | TextureFont = -1; |
| 60 | + | |
| 61 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 62 | + TextureDebugFont = -1; | |
| 63 | +#endif | |
| 60 | 64 | } |
| 61 | 65 | |
| 62 | 66 | //! @brief ディストラクタ |
| @@ -165,6 +169,14 @@ | ||
| 165 | 169 | HUD_myweapon_y[1] = sin(pry)*r; |
| 166 | 170 | HUD_myweapon_z[1] = sin(prx)*r; |
| 167 | 171 | |
| 172 | + | |
| 173 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 174 | + InitDebugFontData(); | |
| 175 | + if( LoadDebugFontTexture() == false ){ | |
| 176 | + return 1; | |
| 177 | + } | |
| 178 | +#endif | |
| 179 | + | |
| 168 | 180 | return 0; |
| 169 | 181 | } |
| 170 | 182 |
| @@ -232,6 +244,12 @@ | ||
| 232 | 244 | return 2; |
| 233 | 245 | } |
| 234 | 246 | |
| 247 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 248 | + if( LoadDebugFontTexture() == false ){ | |
| 249 | + return 2; | |
| 250 | + } | |
| 251 | +#endif | |
| 252 | + | |
| 235 | 253 | #ifdef ENABLE_DEBUGLOG |
| 236 | 254 | //ログに出力 |
| 237 | 255 | OutputLog.WriteLog(LOG_COMPLETE, "", ""); |
| @@ -336,6 +354,11 @@ | ||
| 336 | 354 | void D3DGraphics::CleanupD3Dresource() |
| 337 | 355 | { |
| 338 | 356 | if( TextureFont != -1 ){ CleanupTexture(TextureFont); } |
| 357 | + | |
| 358 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 359 | + if( TextureDebugFont != -1 ){ CleanupTexture(TextureDebugFont); } | |
| 360 | +#endif | |
| 361 | + | |
| 339 | 362 | if( pxmsfont != NULL ){ |
| 340 | 363 | pxmsfont->Release(); |
| 341 | 364 | pxmsfont = NULL; |
| @@ -578,6 +601,144 @@ | ||
| 578 | 601 | return id; |
| 579 | 602 | } |
| 580 | 603 | |
| 604 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 605 | +//! @brief デバック用フォントを読み込む | |
| 606 | +//! @return 成功:true 失敗:false | |
| 607 | +//! @attention この関数を呼び出す前に、InitDebugFontData()関数を実行してください。 | |
| 608 | +bool D3DGraphics::LoadDebugFontTexture() | |
| 609 | +{ | |
| 610 | + int charwidth = 8; | |
| 611 | + int charheight = 16; | |
| 612 | + int width = charwidth * 16; | |
| 613 | + int height = charheight * 8; | |
| 614 | + int headersize = 54; | |
| 615 | + int bufsize = headersize + width*height*3; | |
| 616 | + int datacnt = 0; | |
| 617 | + int id = -1; | |
| 618 | + | |
| 619 | +#ifdef ENABLE_DEBUGLOG | |
| 620 | + //ログに出力 | |
| 621 | + OutputLog.WriteLog(LOG_LOAD, "テクスチャ", "DebugFontTexture"); | |
| 622 | +#endif | |
| 623 | + | |
| 624 | + //既に読み込まれているなら失敗 | |
| 625 | + if( TextureDebugFont != -1 ){ return false; } | |
| 626 | + | |
| 627 | + //空いている認識番号を探す | |
| 628 | + for(int i=0; i<MAX_TEXTURE; i++){ | |
| 629 | + if( ptextures[i] == NULL ){ | |
| 630 | + id = i; | |
| 631 | + break; | |
| 632 | + } | |
| 633 | + } | |
| 634 | + if( id == -1 ){ return false; } | |
| 635 | + | |
| 636 | + //.bmp展開用領域作成 | |
| 637 | + unsigned char *bmpdata = new unsigned char [bufsize]; | |
| 638 | + | |
| 639 | + //.bmpヘッダー作成 | |
| 640 | + for(int i=0; i<headersize; i++){ bmpdata[i] = 0x00; } | |
| 641 | + bmpdata[0x00] = 'B'; | |
| 642 | + bmpdata[0x01] = 'M'; | |
| 643 | + bmpdata[0x02] = (unsigned char)((bufsize >> 0) & 0x000000FF); | |
| 644 | + bmpdata[0x03] = (unsigned char)((bufsize >> 8) & 0x000000FF); | |
| 645 | + bmpdata[0x04] = (unsigned char)((bufsize >> 16) & 0x000000FF); | |
| 646 | + bmpdata[0x05] = (unsigned char)((bufsize >> 24) & 0x000000FF); | |
| 647 | + bmpdata[0x0A] = headersize; | |
| 648 | + bmpdata[0x0E] = headersize - 14; | |
| 649 | + bmpdata[0x12] = width; | |
| 650 | + bmpdata[0x16] = height; | |
| 651 | + bmpdata[0x1A] = 1; | |
| 652 | + bmpdata[0x1C] = 24; | |
| 653 | + bmpdata[0x1E] = 0; | |
| 654 | + bmpdata[0x22] = (unsigned char)(( (bufsize - headersize) >> 0 ) & 0x000000FF); | |
| 655 | + bmpdata[0x23] = (unsigned char)(( (bufsize - headersize) >> 8 ) & 0x000000FF); | |
| 656 | + bmpdata[0x24] = (unsigned char)(( (bufsize - headersize) >> 16 ) & 0x000000FF); | |
| 657 | + bmpdata[0x25] = (unsigned char)(( (bufsize - headersize) >> 24 ) & 0x000000FF); | |
| 658 | + | |
| 659 | + datacnt = headersize; | |
| 660 | + | |
| 661 | + //6行分のデータを作成 | |
| 662 | + for(int cnt_y=5; cnt_y>=0; cnt_y--){ | |
| 663 | + for(int line_y=(charheight-1); line_y>=0; line_y--){ | |
| 664 | + for(int cnt_x=0; cnt_x<16; cnt_x++){ | |
| 665 | + for(int line_x=(charwidth-1); line_x>=0; line_x--){ | |
| 666 | + unsigned char mask; | |
| 667 | + | |
| 668 | + //ビット判定用マスク作成 | |
| 669 | + switch(line_x){ | |
| 670 | + case 0: mask = 0x01; break; | |
| 671 | + case 1: mask = 0x02; break; | |
| 672 | + case 2: mask = 0x04; break; | |
| 673 | + case 3: mask = 0x08; break; | |
| 674 | + case 4: mask = 0x10; break; | |
| 675 | + case 5: mask = 0x20; break; | |
| 676 | + case 6: mask = 0x40; break; | |
| 677 | + case 7: mask = 0x80; break; | |
| 678 | + default: mask = 0x00; //事実上エラー | |
| 679 | + } | |
| 680 | + | |
| 681 | + //該当ビットが1なら白、0なら黒。 | |
| 682 | + if( (DebugFontData[cnt_y*16 + cnt_x][line_y] & mask) != 0 ){ | |
| 683 | + bmpdata[datacnt + 0] = 255; | |
| 684 | + bmpdata[datacnt + 1] = 255; | |
| 685 | + bmpdata[datacnt + 2] = 255; | |
| 686 | + } | |
| 687 | + else{ | |
| 688 | + bmpdata[datacnt + 0] = 0; | |
| 689 | + bmpdata[datacnt + 1] = 0; | |
| 690 | + bmpdata[datacnt + 2] = 0; | |
| 691 | + } | |
| 692 | + | |
| 693 | + datacnt += 3; | |
| 694 | + } | |
| 695 | + } | |
| 696 | + } | |
| 697 | + } | |
| 698 | + | |
| 699 | + //制御コードが入っている上の2行 32文字分は、空欄にする。 | |
| 700 | + for(int cnt_y=0; cnt_y<2; cnt_y++){ | |
| 701 | + for(int line_y=(charheight-1); line_y>=0; line_y--){ | |
| 702 | + for(int cnt_x=0; cnt_x<16; cnt_x++){ | |
| 703 | + for(int line_x=0; line_x<charwidth; line_x++){ | |
| 704 | + bmpdata[datacnt + 0] = 0; | |
| 705 | + bmpdata[datacnt + 1] = 0; | |
| 706 | + bmpdata[datacnt + 2] = 0; | |
| 707 | + | |
| 708 | + datacnt += 3; | |
| 709 | + } | |
| 710 | + } | |
| 711 | + } | |
| 712 | + } | |
| 713 | + | |
| 714 | + //.bmpテクスチャとして読み込む | |
| 715 | + if( FAILED( D3DXCreateTextureFromFileInMemoryEx(pd3dDevice, bmpdata, bufsize, width, height, 1, 0, D3DFMT_A1R5G5B5, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_ARGB(255, 0, 0, 0), NULL, NULL, &ptextures[id]) ) ) { | |
| 716 | + TextureDebugFont = -1; | |
| 717 | + return false; | |
| 718 | + } | |
| 719 | + | |
| 720 | + /* | |
| 721 | + //.bmpとして保存してみる | |
| 722 | + FILE *fp; | |
| 723 | + fp = fopen("debugfont-test.bmp", "wb"); | |
| 724 | + fwrite(bmpdata, sizeof(unsigned char), bufsize, fp); | |
| 725 | + fclose(fp); | |
| 726 | + */ | |
| 727 | + | |
| 728 | + //.bmp展開用領域解放 | |
| 729 | + delete bmpdata; | |
| 730 | + | |
| 731 | +#ifdef ENABLE_DEBUGLOG | |
| 732 | + //ログに出力 | |
| 733 | + OutputLog.WriteLog(LOG_COMPLETE, "", id); | |
| 734 | +#endif | |
| 735 | + | |
| 736 | + //テクスチャID設定 | |
| 737 | + TextureDebugFont = id; | |
| 738 | + return true; | |
| 739 | +} | |
| 740 | +#endif | |
| 741 | + | |
| 581 | 742 | //! @brief テクスチャのサイズを取得 |
| 582 | 743 | //! @param id テクスチャ認識番号 |
| 583 | 744 | //! @param width 幅を受け取るポインタ |
| @@ -1426,6 +1587,93 @@ | ||
| 1426 | 1587 | End2DRender(); |
| 1427 | 1588 | } |
| 1428 | 1589 | |
| 1590 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 1591 | +//! @brief 文字を表示(デバック用フォント使用) | |
| 1592 | +//! @param x x座標 | |
| 1593 | +//! @param y y座標 | |
| 1594 | +//! @param str 文字列 (改行コード:<b>不可</b>) | |
| 1595 | +//! @param color 色 | |
| 1596 | +//! @attention 一文字の幅および高さは 8x16 固定です。 | |
| 1597 | +//! @attention 文字を二重に重ねて立体感を出さないと見にくくなります。 | |
| 1598 | +void D3DGraphics::Draw2DTextureDebugFontText(int x, int y, char *str, int color) | |
| 1599 | +{ | |
| 1600 | + int fontwidth = 8; | |
| 1601 | + int fontheight = 16; | |
| 1602 | + | |
| 1603 | + //テクスチャフォントの取得に失敗していれば、処理しない | |
| 1604 | + if( TextureDebugFont == -1 ){ return; } | |
| 1605 | + | |
| 1606 | + //2D描画用設定を適用 | |
| 1607 | + Start2DRender(); | |
| 1608 | + | |
| 1609 | + // テクスチャフィルタ無効化 | |
| 1610 | + pd3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT); | |
| 1611 | + pd3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT); | |
| 1612 | + pd3dDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_POINT); | |
| 1613 | + | |
| 1614 | + int w; | |
| 1615 | + float font_u, font_v; | |
| 1616 | + float t_u, t_v; | |
| 1617 | + TLVERTX pBoxVertices[4]; | |
| 1618 | + | |
| 1619 | + //1文字のUV座標を計算 | |
| 1620 | + font_u = 1.0f / 16; | |
| 1621 | + font_v = 1.0f / 8; | |
| 1622 | + | |
| 1623 | + //ワールド座標を原点に戻す | |
| 1624 | + ResetWorldTransform(); | |
| 1625 | + | |
| 1626 | + //テクスチャをフォントテクスチャに設定 | |
| 1627 | + pd3dDevice->SetTexture( 0, ptextures[TextureDebugFont] ); | |
| 1628 | + | |
| 1629 | + //データ形式を設定 | |
| 1630 | + pd3dDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1); | |
| 1631 | + | |
| 1632 | + // 与えられた文字数分ループ | |
| 1633 | + for(int i=0; i<(int)strlen(str); i++){ | |
| 1634 | + //UV座標を計算 | |
| 1635 | + w = str[i]; | |
| 1636 | + if( w < 0 ){ w = ' '; } | |
| 1637 | + t_u = (w % 16) * font_u; | |
| 1638 | + t_v = (w / 16) * font_v; | |
| 1639 | + | |
| 1640 | + //頂点座標・UV座標・色を設定 | |
| 1641 | + pBoxVertices[0].x = (float)x + i*fontwidth; | |
| 1642 | + pBoxVertices[0].y = (float)y; | |
| 1643 | + pBoxVertices[0].tu = t_u; | |
| 1644 | + pBoxVertices[0].tv = t_v; | |
| 1645 | + pBoxVertices[1].x = (float)x + fontwidth + i*fontwidth; | |
| 1646 | + pBoxVertices[1].y = (float)y; | |
| 1647 | + pBoxVertices[1].tu = t_u + font_u; | |
| 1648 | + pBoxVertices[1].tv = t_v; | |
| 1649 | + pBoxVertices[2].x = (float)x + i*fontwidth; | |
| 1650 | + pBoxVertices[2].y = (float)y + fontheight; | |
| 1651 | + pBoxVertices[2].tu = t_u; | |
| 1652 | + pBoxVertices[2].tv = t_v + font_v; | |
| 1653 | + pBoxVertices[3].x = (float)x + fontwidth + i*fontwidth; | |
| 1654 | + pBoxVertices[3].y = (float)y + fontheight; | |
| 1655 | + pBoxVertices[3].tu = t_u + font_u; | |
| 1656 | + pBoxVertices[3].tv = t_v + font_v; | |
| 1657 | + for(int j=0; j<4; j++){ | |
| 1658 | + pBoxVertices[j].z = 0.0f; | |
| 1659 | + pBoxVertices[j].rhw = 1.0f; | |
| 1660 | + pBoxVertices[j].color = color; | |
| 1661 | + } | |
| 1662 | + | |
| 1663 | + //表示 | |
| 1664 | + pd3dDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pBoxVertices, sizeof(TLVERTX)); | |
| 1665 | + } | |
| 1666 | + | |
| 1667 | + //テクスチャフィルタ有効化 | |
| 1668 | + pd3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); | |
| 1669 | + pd3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); | |
| 1670 | + pd3dDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR); | |
| 1671 | + | |
| 1672 | + //2D描画用設定を解除 | |
| 1673 | + End2DRender(); | |
| 1674 | +} | |
| 1675 | +#endif | |
| 1676 | + | |
| 1429 | 1677 | //! @brief 線を描画 |
| 1430 | 1678 | //! @param x1 始点の x座標 |
| 1431 | 1679 | //! @param y1 始点の y座標 |
| @@ -74,6 +74,10 @@ | ||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | TextureFont = -1; |
| 77 | + | |
| 78 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 79 | + TextureDebugFont = -1; | |
| 80 | +#endif | |
| 77 | 81 | } |
| 78 | 82 | |
| 79 | 83 | //! @brief ディストラクタ |
| @@ -199,7 +203,14 @@ | ||
| 199 | 203 | HUD_myweapon_y[1] = sin(pry)*r; |
| 200 | 204 | HUD_myweapon_z[1] = sin(prx)*r; |
| 201 | 205 | |
| 206 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 207 | + InitDebugFontData(); | |
| 208 | + if( LoadDebugFontTexture() == false ){ | |
| 209 | + return 1; | |
| 210 | + } | |
| 211 | +#endif | |
| 202 | 212 | |
| 213 | + | |
| 203 | 214 | //libjpeg初期化 |
| 204 | 215 | cinfo.err = jpeg_std_error(&jerr); |
| 205 | 216 | jpeg_create_decompress(&cinfo); |
| @@ -1260,6 +1271,139 @@ | ||
| 1260 | 1271 | return true; |
| 1261 | 1272 | } |
| 1262 | 1273 | |
| 1274 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 1275 | +//! @brief デバック用フォントを読み込む | |
| 1276 | +//! @return 成功:true 失敗:false | |
| 1277 | +//! @attention この関数を呼び出す前に、InitDebugFontData()関数を実行してください。 | |
| 1278 | +bool D3DGraphics::LoadDebugFontTexture() | |
| 1279 | +{ | |
| 1280 | + int charwidth = 8; | |
| 1281 | + int charheight = 16; | |
| 1282 | + int width = charwidth * 16; | |
| 1283 | + int height = charheight * 8; | |
| 1284 | + | |
| 1285 | + int datacnt = 0; | |
| 1286 | + int id = -1; | |
| 1287 | + | |
| 1288 | +#ifdef ENABLE_DEBUGLOG | |
| 1289 | + //ログに出力 | |
| 1290 | + OutputLog.WriteLog(LOG_LOAD, "テクスチャ", "DebugFontTexture"); | |
| 1291 | +#endif | |
| 1292 | + | |
| 1293 | + //既に読み込まれているなら失敗 | |
| 1294 | + if( TextureDebugFont != -1 ){ return false; } | |
| 1295 | + | |
| 1296 | + //空いている認識番号を探す | |
| 1297 | + for(int i=0; i<MAX_TEXTURE; i++){ | |
| 1298 | + if( ptextures[i].useflag == false ){ | |
| 1299 | + id = i; | |
| 1300 | + break; | |
| 1301 | + } | |
| 1302 | + } | |
| 1303 | + if( id == -1 ){ return false; } | |
| 1304 | + | |
| 1305 | + unsigned char *data = new unsigned char [width*height*4]; | |
| 1306 | + | |
| 1307 | + //制御コードが入っている2行 32文字分は、空欄にする。 | |
| 1308 | + for(int cnt_y=0; cnt_y<2; cnt_y++){ | |
| 1309 | + for(int line_y=0; line_y<charheight; line_y++){ | |
| 1310 | + for(int cnt_x=0; cnt_x<16; cnt_x++){ | |
| 1311 | + for(int line_x=0; line_x<charwidth; line_x++){ | |
| 1312 | + data[datacnt + 0] = 0; | |
| 1313 | + data[datacnt + 1] = 0; | |
| 1314 | + data[datacnt + 2] = 0; | |
| 1315 | + data[datacnt + 3] = 0; | |
| 1316 | + | |
| 1317 | + datacnt += 4; | |
| 1318 | + } | |
| 1319 | + } | |
| 1320 | + } | |
| 1321 | + } | |
| 1322 | + | |
| 1323 | + //6行分のデータを作成 | |
| 1324 | + for(int cnt_y=0; cnt_y<6; cnt_y++){ | |
| 1325 | + for(int line_y=0; line_y<charheight; line_y++){ | |
| 1326 | + for(int cnt_x=0; cnt_x<16; cnt_x++){ | |
| 1327 | + for(int line_x=(charwidth-1); line_x>=0; line_x--){ | |
| 1328 | + unsigned char mask; | |
| 1329 | + | |
| 1330 | + //ビット判定用マスク作成 | |
| 1331 | + switch(line_x){ | |
| 1332 | + case 0: mask = 0x01; break; | |
| 1333 | + case 1: mask = 0x02; break; | |
| 1334 | + case 2: mask = 0x04; break; | |
| 1335 | + case 3: mask = 0x08; break; | |
| 1336 | + case 4: mask = 0x10; break; | |
| 1337 | + case 5: mask = 0x20; break; | |
| 1338 | + case 6: mask = 0x40; break; | |
| 1339 | + case 7: mask = 0x80; break; | |
| 1340 | + default: mask = 0x00; //事実上エラー | |
| 1341 | + } | |
| 1342 | + | |
| 1343 | + //該当ビットが1なら白、0なら黒。 | |
| 1344 | + if( (DebugFontData[cnt_y*16 + cnt_x][line_y] & mask) != 0 ){ | |
| 1345 | + data[datacnt + 0] = 255; | |
| 1346 | + data[datacnt + 1] = 255; | |
| 1347 | + data[datacnt + 2] = 255; | |
| 1348 | + data[datacnt + 3] = 255; | |
| 1349 | + } | |
| 1350 | + else{ | |
| 1351 | + data[datacnt + 0] = 0; | |
| 1352 | + data[datacnt + 1] = 0; | |
| 1353 | + data[datacnt + 2] = 0; | |
| 1354 | + data[datacnt + 3] = 0; | |
| 1355 | + } | |
| 1356 | + | |
| 1357 | + datacnt += 4; | |
| 1358 | + } | |
| 1359 | + } | |
| 1360 | + } | |
| 1361 | + } | |
| 1362 | + | |
| 1363 | + //テクスチャ有効 | |
| 1364 | + glEnable(GL_TEXTURE_2D); | |
| 1365 | + | |
| 1366 | + HDC hDC; | |
| 1367 | + hDC = GetDC(hWnd); | |
| 1368 | + wglMakeCurrent(hDC, hGLRC); | |
| 1369 | + glGenTextures(1, &(textureobjname[id])); | |
| 1370 | + ReleaseDC(hWnd, hDC); | |
| 1371 | + | |
| 1372 | + glBindTexture(GL_TEXTURE_2D, textureobjname[id]); | |
| 1373 | + | |
| 1374 | + //OpenGLにセット | |
| 1375 | + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); | |
| 1376 | + | |
| 1377 | + //ミップマップ設定 | |
| 1378 | + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | |
| 1379 | + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | |
| 1380 | + | |
| 1381 | + //乗算合成 | |
| 1382 | + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); | |
| 1383 | + | |
| 1384 | + //テクスチャ無効 | |
| 1385 | + glDisable(GL_TEXTURE_2D); | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + //構造体に代入 | |
| 1389 | + ptextures[id].data = data; | |
| 1390 | + ptextures[id].width = width; | |
| 1391 | + ptextures[id].height = height; | |
| 1392 | + | |
| 1393 | + ptextures[id].useflag = true; | |
| 1394 | + | |
| 1395 | + | |
| 1396 | +#ifdef ENABLE_DEBUGLOG | |
| 1397 | + //ログに出力 | |
| 1398 | + OutputLog.WriteLog(LOG_COMPLETE, "", id); | |
| 1399 | +#endif | |
| 1400 | + | |
| 1401 | + //テクスチャID設定 | |
| 1402 | + TextureDebugFont = id; | |
| 1403 | + return true; | |
| 1404 | +} | |
| 1405 | +#endif | |
| 1406 | + | |
| 1263 | 1407 | //! @brief テクスチャのサイズを取得 |
| 1264 | 1408 | //! @param id テクスチャ認識番号 |
| 1265 | 1409 | //! @param width 幅を受け取るポインタ |
| @@ -2125,6 +2269,101 @@ | ||
| 2125 | 2269 | delete [] TexCoordAry; |
| 2126 | 2270 | } |
| 2127 | 2271 | |
| 2272 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 2273 | +//! @brief 文字を表示(デバック用フォント使用) | |
| 2274 | +//! @param x x座標 | |
| 2275 | +//! @param y y座標 | |
| 2276 | +//! @param str 文字列 (改行コード:<b>不可</b>) | |
| 2277 | +//! @param color 色 | |
| 2278 | +//! @attention 一文字の幅および高さは 8x16 固定です。 | |
| 2279 | +//! @attention 文字を二重に重ねて立体感を出さないと見にくくなります。 | |
| 2280 | +void D3DGraphics::Draw2DTextureDebugFontText(int x, int y, char *str, int color) | |
| 2281 | +{ | |
| 2282 | + int fontwidth = 8; | |
| 2283 | + int fontheight = 16; | |
| 2284 | + | |
| 2285 | + //テクスチャフォントの取得に失敗していれば、処理しない | |
| 2286 | + if( TextureDebugFont == -1 ){ return; } | |
| 2287 | + | |
| 2288 | + int strlens = (int)strlen(str); | |
| 2289 | + | |
| 2290 | + float *VertexAry = new float [strlens*6*2]; | |
| 2291 | + unsigned char *ColorAry = new unsigned char [strlens*6*4]; | |
| 2292 | + float *TexCoordAry = new float [strlens*6*2]; | |
| 2293 | + | |
| 2294 | + //2D描画用設定を適用 | |
| 2295 | + Start2DRender(); | |
| 2296 | + | |
| 2297 | + int w; | |
| 2298 | + float font_u, font_v; | |
| 2299 | + float t_u, t_v; | |
| 2300 | + | |
| 2301 | + //1文字のUV座標を計算 | |
| 2302 | + font_u = 1.0f / 16; | |
| 2303 | + font_v = 1.0f / 8; | |
| 2304 | + | |
| 2305 | + //テクスチャ有効 | |
| 2306 | + glEnable(GL_TEXTURE_2D); | |
| 2307 | + | |
| 2308 | + //テクスチャをセット | |
| 2309 | + SetTexture(TextureDebugFont); | |
| 2310 | + | |
| 2311 | + //配列有効化 | |
| 2312 | + glEnableClientState(GL_VERTEX_ARRAY); | |
| 2313 | + glEnableClientState(GL_COLOR_ARRAY); | |
| 2314 | + glEnableClientState(GL_TEXTURE_COORD_ARRAY); | |
| 2315 | + | |
| 2316 | + //色情報配列を用意 | |
| 2317 | + ColorAry[0] = (color>>24)&0xFF; | |
| 2318 | + ColorAry[1] = (color>>16)&0xFF; | |
| 2319 | + ColorAry[2] = (color>>8)&0xFF; | |
| 2320 | + ColorAry[3] = color&0xFF; | |
| 2321 | + for(int i=1; i<strlens*6; i++){ | |
| 2322 | + memcpy(&(ColorAry[i*4]), ColorAry, sizeof(unsigned char)*4); | |
| 2323 | + } | |
| 2324 | + | |
| 2325 | + // 与えられた文字数分ループ | |
| 2326 | + for(int i=0; i<strlens; i++){ | |
| 2327 | + //UV座標を計算 | |
| 2328 | + w = str[i]; | |
| 2329 | + if( w < 0 ){ w = ' '; } | |
| 2330 | + t_u = (w % 16) * font_u; | |
| 2331 | + t_v = (w / 16) * font_v; | |
| 2332 | + | |
| 2333 | + VertexAry[0 + i*12] = (float)x + i*fontwidth; VertexAry[1 + i*12] = (float)y; | |
| 2334 | + VertexAry[2 + i*12] = (float)x + i*fontwidth; VertexAry[3 + i*12] = (float)y; | |
| 2335 | + VertexAry[4 + i*12] = (float)x + fontwidth + i*fontwidth; VertexAry[5 + i*12] = (float)y; | |
| 2336 | + VertexAry[6 + i*12] = (float)x + i*fontwidth; VertexAry[7 + i*12] = (float)y + fontheight; | |
| 2337 | + VertexAry[8 + i*12] = (float)x + fontwidth + i*fontwidth; VertexAry[9 + i*12] = (float)y + fontheight; | |
| 2338 | + VertexAry[10 + i*12] = (float)x + fontwidth + i*fontwidth; VertexAry[11 + i*12] = (float)y + fontheight; | |
| 2339 | + TexCoordAry[0 + i*12] = t_u; TexCoordAry[1 + i*12] = t_v; | |
| 2340 | + TexCoordAry[2 + i*12] = t_u; TexCoordAry[3 + i*12] = t_v; | |
| 2341 | + TexCoordAry[4 + i*12] = t_u + font_u; TexCoordAry[5 + i*12] = t_v; | |
| 2342 | + TexCoordAry[6 + i*12] = t_u; TexCoordAry[7 + i*12] = t_v + font_v; | |
| 2343 | + TexCoordAry[8 + i*12] = t_u + font_u; TexCoordAry[9 + i*12] = t_v + font_v; | |
| 2344 | + TexCoordAry[10 + i*12] = t_u + font_u; TexCoordAry[11 + i*12] = t_v + font_v; | |
| 2345 | + } | |
| 2346 | + | |
| 2347 | + //描画 | |
| 2348 | + glVertexPointer(2, GL_FLOAT, 0, VertexAry); | |
| 2349 | + glColorPointer(4, GL_UNSIGNED_BYTE, 0, ColorAry); | |
| 2350 | + glTexCoordPointer(2, GL_FLOAT, 0, TexCoordAry); | |
| 2351 | + glDrawArrays(GL_TRIANGLE_STRIP, 1, strlens*6-2); | |
| 2352 | + | |
| 2353 | + //配列無効化 | |
| 2354 | + glDisableClientState(GL_VERTEX_ARRAY); | |
| 2355 | + glDisableClientState(GL_COLOR_ARRAY); | |
| 2356 | + glDisableClientState(GL_TEXTURE_COORD_ARRAY); | |
| 2357 | + | |
| 2358 | + //2D描画用設定を解除 | |
| 2359 | + End2DRender(); | |
| 2360 | + | |
| 2361 | + delete [] VertexAry; | |
| 2362 | + delete [] ColorAry; | |
| 2363 | + delete [] TexCoordAry; | |
| 2364 | +} | |
| 2365 | +#endif | |
| 2366 | + | |
| 2128 | 2367 | //! @brief 線を描画 |
| 2129 | 2368 | //! @param x1 始点の x座標 |
| 2130 | 2369 | //! @param y1 始点の y座標 |
| @@ -194,6 +194,13 @@ | ||
| 194 | 194 | void Start2DRender(); |
| 195 | 195 | void End2DRender(); |
| 196 | 196 | |
| 197 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 198 | + unsigned char DebugFontData[96][16]; //!< デバック用フォントデータ格納配列 | |
| 199 | + int TextureDebugFont; //!< デバック用フォントのテクスチャID | |
| 200 | + void InitDebugFontData(); | |
| 201 | + bool LoadDebugFontTexture(); | |
| 202 | +#endif | |
| 203 | + | |
| 197 | 204 | #else //GRAPHICS_OPENGL |
| 198 | 205 | |
| 199 | 206 | HWND hWnd; //!< ウィンドウハンドル |
| @@ -243,6 +250,13 @@ | ||
| 243 | 250 | void Start2DRender(); |
| 244 | 251 | void End2DRender(); |
| 245 | 252 | |
| 253 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 254 | + unsigned char DebugFontData[96][16]; //!< デバック用フォントデータ格納配列 | |
| 255 | + int TextureDebugFont; //!< デバック用フォントのテクスチャID | |
| 256 | + void InitDebugFontData(); | |
| 257 | + bool LoadDebugFontTexture(); | |
| 258 | +#endif | |
| 259 | + | |
| 246 | 260 | #endif //GRAPHICS_OPENGL |
| 247 | 261 | |
| 248 | 262 | public: |
| @@ -281,6 +295,9 @@ | ||
| 281 | 295 | void Draw2DMSFontText(int x, int y, char *str, int color); |
| 282 | 296 | void Draw2DMSFontTextCenter(int x, int y, int w, int h, char *str, int color); |
| 283 | 297 | void Draw2DTextureFontText(int x, int y, char *str, int color, int fontwidth, int fontheight); |
| 298 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 299 | + void Draw2DTextureDebugFontText(int x, int y, char *str, int color); | |
| 300 | +#endif | |
| 284 | 301 | void Draw2DLine(int x1, int y1, int x2, int y2, int color); |
| 285 | 302 | void Draw2DCycle(int x, int y, int r, int color); |
| 286 | 303 | void Draw2DBox(int x1, int y1, int x2, int y2, int color); |
| @@ -2109,7 +2109,7 @@ | ||
| 2109 | 2109 | |
| 2110 | 2110 | //デバック用・ゲーム情報の表示 |
| 2111 | 2111 | if( (ShowInfo_Debugmode == true)||(Camera_Debugmode == true) ){ |
| 2112 | - //システムフォントによる表示 見やすい・重い | |
| 2112 | + //システムフォントによる表示 日本語可・重い | |
| 2113 | 2113 | /* |
| 2114 | 2114 | sprintf(str, "OpenXOPS テスト\ncamera x:%.2f y:%.2f z:%.2f rx:%.2f ry:%.2f\n" |
| 2115 | 2115 | "human[%d]:x:%.2f y:%.2f z:%.2f rx:%.2f\n" |
| @@ -2121,22 +2121,19 @@ | ||
| 2121 | 2121 | d3dg->Draw2DMSFontText(10, 10, str, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f)); |
| 2122 | 2122 | */ |
| 2123 | 2123 | |
| 2124 | - //テクスチャフォントによる表示 軽い・見にくい | |
| 2124 | + //テクスチャフォントによる表示 軽い・半角英数字と記号のみ | |
| 2125 | 2125 | sprintf(str, "frame:%d time %02d:%02d", framecnt, framecnt/(int)GAMEFPS/60, framecnt/(int)GAMEFPS%60); |
| 2126 | - d3dg->Draw2DTextureFontText(10+1, 10+1, str, d3dg->GetColorCode(0.1f,0.1f,0.1f,1.0f), 10, 14); | |
| 2127 | - d3dg->Draw2DTextureFontText(10, 10, str, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), 10, 14); | |
| 2126 | + d3dg->Draw2DTextureDebugFontText(10+1, 10+1, str, d3dg->GetColorCode(0.1f,0.1f,0.1f,1.0f)); | |
| 2127 | + d3dg->Draw2DTextureDebugFontText(10, 10, str, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f)); | |
| 2128 | 2128 | sprintf(str, "camera x:%.2f y:%.2f z:%.2f rx:%.2f ry:%.2f", camera_x, camera_y, camera_z, camera_rx, camera_ry); |
| 2129 | - d3dg->Draw2DTextureFontText(10+1, 30+1, str, d3dg->GetColorCode(0.1f,0.1f,0.1f,1.0f), 10, 14); | |
| 2130 | - d3dg->Draw2DTextureFontText(10, 30, str, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), 10, 14); | |
| 2129 | + d3dg->Draw2DTextureDebugFontText(10+1, 30+1, str, d3dg->GetColorCode(0.1f,0.1f,0.1f,1.0f)); | |
| 2130 | + d3dg->Draw2DTextureDebugFontText(10, 30, str, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f)); | |
| 2131 | 2131 | sprintf(str, "human[%d] x:%.2f y:%.2f z:%.2f rx:%.2f HP:%d", ObjMgr.GetPlayerID(), human_x, human_y, human_z, human_rx, hp); |
| 2132 | - d3dg->Draw2DTextureFontText(10+1, 50+1, str, d3dg->GetColorCode(0.1f,0.1f,0.1f,1.0f), 10, 14); | |
| 2133 | - d3dg->Draw2DTextureFontText(10, 50, str, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), 10, 14); | |
| 2134 | - sprintf(str, "Input:%02dms Object:%02dms AI:%02dms Event:%02dms Sound:%02dms", time_input, time_process_object, time_process_ai, time_process_event, time_sound); | |
| 2135 | - d3dg->Draw2DTextureFontText(10+1, 70+1, str, d3dg->GetColorCode(0.1f,0.1f,0.1f,1.0f), 10, 14); | |
| 2136 | - d3dg->Draw2DTextureFontText(10, 70, str, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), 10, 14); | |
| 2137 | - sprintf(str, "Render:%02dms", time_render); | |
| 2138 | - d3dg->Draw2DTextureFontText(10+1, 90+1, str, d3dg->GetColorCode(0.1f,0.1f,0.1f,1.0f), 10, 14); | |
| 2139 | - d3dg->Draw2DTextureFontText(10, 90, str, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), 10, 14); | |
| 2132 | + d3dg->Draw2DTextureDebugFontText(10+1, 50+1, str, d3dg->GetColorCode(0.1f,0.1f,0.1f,1.0f)); | |
| 2133 | + d3dg->Draw2DTextureDebugFontText(10, 50, str, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f)); | |
| 2134 | + sprintf(str, "Input:%02dms Object:%02dms AI:%02dms Event:%02dms Sound:%02dms Render:%02dms", time_input, time_process_object, time_process_ai, time_process_event, time_sound, time_render); | |
| 2135 | + d3dg->Draw2DTextureDebugFontText(10+1, 70+1, str, d3dg->GetColorCode(0.1f,0.1f,0.1f,1.0f)); | |
| 2136 | + d3dg->Draw2DTextureDebugFontText(10, 70, str, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f)); | |
| 2140 | 2137 | } |
| 2141 | 2138 | |
| 2142 | 2139 | //ゲーム実行速度の表示 |
| @@ -2329,20 +2326,20 @@ | ||
| 2329 | 2326 | HumanAI[AIdebuginfoID].GetPathPointData(&ppdata); |
| 2330 | 2327 | |
| 2331 | 2328 | sprintf(str, "AI debug info [ID:%d]", AIdebuginfoID); |
| 2332 | - d3dg->Draw2DTextureFontText(20 +1, 130 +1, str, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f), 12, 16); | |
| 2333 | - d3dg->Draw2DTextureFontText(20, 130, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f), 12, 16); | |
| 2329 | + d3dg->Draw2DTextureDebugFontText(20 +1, 130 +1, str, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2330 | + d3dg->Draw2DTextureDebugFontText(20, 130, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f)); | |
| 2334 | 2331 | sprintf(str, "(X:%.2f Y:%.2f Z:%.2f RX:%.2f HP:%d)", posx, posy, posz, rx, hp); |
| 2335 | - d3dg->Draw2DTextureFontText(20 +1, 150 +1, str, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f), 10, 14); | |
| 2336 | - d3dg->Draw2DTextureFontText(20, 150, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f), 10, 14); | |
| 2332 | + d3dg->Draw2DTextureDebugFontText(20 +1, 150 +1, str, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2333 | + d3dg->Draw2DTextureDebugFontText(20, 150, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f)); | |
| 2337 | 2334 | sprintf(str, "Mode:%s TargetEnemyID:%d", modestr, EnemyID); |
| 2338 | - d3dg->Draw2DTextureFontText(20 +1, 170 +1, str, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f), 12, 16); | |
| 2339 | - d3dg->Draw2DTextureFontText(20, 170, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f), 12, 16); | |
| 2335 | + d3dg->Draw2DTextureDebugFontText(20 +1, 170 +1, str, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2336 | + d3dg->Draw2DTextureDebugFontText(20, 170, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f)); | |
| 2340 | 2337 | sprintf(str, "PointPath:[%d][%d][%d][%d]", ppdata.p1, ppdata.p2, ppdata.p3, ppdata.p4); |
| 2341 | - d3dg->Draw2DTextureFontText(20 +1, 190 +1, str, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f), 12, 16); | |
| 2342 | - d3dg->Draw2DTextureFontText(20, 190, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f), 12, 16); | |
| 2338 | + d3dg->Draw2DTextureDebugFontText(20 +1, 190 +1, str, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2339 | + d3dg->Draw2DTextureDebugFontText(20, 190, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f)); | |
| 2343 | 2340 | sprintf(str, "MovePosX:%.2f MovePosZ:%.2f", mposx, mposz); |
| 2344 | - d3dg->Draw2DTextureFontText(20 +1, 210 +1, str, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f), 12, 16); | |
| 2345 | - d3dg->Draw2DTextureFontText(20, 210, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f), 12, 16); | |
| 2341 | + d3dg->Draw2DTextureDebugFontText(20 +1, 210 +1, str, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2342 | + d3dg->Draw2DTextureDebugFontText(20, 210, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f)); | |
| 2346 | 2343 | } |
| 2347 | 2344 | } |
| 2348 | 2345 |
| @@ -2741,14 +2738,13 @@ | ||
| 2741 | 2738 | |
| 2742 | 2739 | //コマンドリスト |
| 2743 | 2740 | if( strcmp(NewCommand, "help") == 0 ){ |
| 2744 | - AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "help human result event"); | |
| 2745 | - AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "mif ver"); | |
| 2746 | - AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "info view center map"); | |
| 2747 | - AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "aiinfo <NUM> tag radar inmap"); | |
| 2748 | - AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "revive treat <NUM> nodamage <NUM>"); | |
| 2749 | - AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "kill <NUM> break <NUM> newobj <NUM> ff"); | |
| 2750 | - AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "bot nofight caution stop"); | |
| 2751 | - AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "estop speed ss clear"); | |
| 2741 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "help human result event mif ver"); | |
| 2742 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "info view center map aiinfo <NUM>"); | |
| 2743 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "tag radar inmap"); | |
| 2744 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "ff revive kill <NUM> treat <NUM> nodamage <NUM>"); | |
| 2745 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "break <NUM> newobj <NUM>"); | |
| 2746 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "bot nofight caution stop estop speed"); | |
| 2747 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "ss clear"); | |
| 2752 | 2748 | } |
| 2753 | 2749 | |
| 2754 | 2750 | //MIFの情報表示 |
| @@ -3253,13 +3249,13 @@ | ||
| 3253 | 3249 | void maingame::RenderConsole() |
| 3254 | 3250 | { |
| 3255 | 3251 | //下地 |
| 3256 | - d3dg->Draw2DBox(0, 0, SCREEN_WIDTH, (MAX_CONSOLELINES+1)*18 + 5 + 5, d3dg->GetColorCode(0.0f,0.0f,0.0f,0.75f)); | |
| 3252 | + d3dg->Draw2DBox(0, 0, SCREEN_WIDTH, (MAX_CONSOLELINES+1)*17 + 5 + 5, d3dg->GetColorCode(0.0f,0.0f,0.0f,0.75f)); | |
| 3257 | 3253 | |
| 3258 | 3254 | //表示中の文字 |
| 3259 | 3255 | for(int i=0; i<MAX_CONSOLELINES; i++){ |
| 3260 | 3256 | if( InfoConsoleData[i].textdata[0] != NULL ){ |
| 3261 | - d3dg->Draw2DTextureFontText(5+1, i*18+5+1, InfoConsoleData[i].textdata, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f), 14, 17); | |
| 3262 | - d3dg->Draw2DTextureFontText(5, i*18+5, InfoConsoleData[i].textdata, InfoConsoleData[i].color, 14, 17); | |
| 3257 | + d3dg->Draw2DTextureDebugFontText(5+1, i*17+5+1, InfoConsoleData[i].textdata, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 3258 | + d3dg->Draw2DTextureDebugFontText(5, i*17+5, InfoConsoleData[i].textdata, InfoConsoleData[i].color); | |
| 3263 | 3259 | } |
| 3264 | 3260 | } |
| 3265 | 3261 |
| @@ -3268,8 +3264,8 @@ | ||
| 3268 | 3264 | for(cnt=0; cnt<MAX_CONSOLELINES; cnt++){ |
| 3269 | 3265 | if( InfoConsoleData[cnt].textdata[0] == NULL ){ break; } |
| 3270 | 3266 | } |
| 3271 | - d3dg->Draw2DTextureFontText(5+1, cnt*18+5+1, InputConsoleData->textdata, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f), 14, 17); | |
| 3272 | - d3dg->Draw2DTextureFontText(5, cnt*18+5, InputConsoleData->textdata, InputConsoleData->color, 14, 17); | |
| 3267 | + d3dg->Draw2DTextureDebugFontText(5+1, cnt*17+5+1, InputConsoleData->textdata, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 3268 | + d3dg->Draw2DTextureDebugFontText(5, cnt*17+5, InputConsoleData->textdata, InputConsoleData->color); | |
| 3273 | 3269 | } |
| 3274 | 3270 | |
| 3275 | 3271 | #endif |
| @@ -32,8 +32,6 @@ | ||
| 32 | 32 | #ifndef GAMEMAIN_H |
| 33 | 33 | #define GAMEMAIN_H |
| 34 | 34 | |
| 35 | -#define ENABLE_DEBUGCONSOLE //!< @brief デバック用コンソールの有効化(コメント化で機能無効) | |
| 36 | - | |
| 37 | 35 | #define MAINMENU_X 280 //!< メニューの表示 X座標(左上基準) |
| 38 | 36 | #define MAINMENU_Y 140 //!< メニューの表示 Y座標(〃) |
| 39 | 37 | #define TOTAL_MENUITEMS 8 //!< メニュー1画面に表示するミッション数 |
| @@ -56,17 +54,17 @@ | ||
| 56 | 54 | |
| 57 | 55 | #define TOTAL_EVENTENT_SHOWMESSEC 5.0f //!< イベントメッセージを表示する秒数 |
| 58 | 56 | |
| 59 | -#ifdef ENABLE_DEBUGCONSOLE | |
| 60 | - #define MAX_CONSOLELEN 45 //!< デバック用コンソールの文字数(行) | |
| 61 | - #define MAX_CONSOLELINES 9 //!< デバック用コンソールの行数 | |
| 62 | - #define CONSOLE_PROMPT ">" //!< デバック用コンソールのプロンプト | |
| 63 | -#endif | |
| 64 | - | |
| 65 | 57 | #ifndef H_LAYERLEVEL |
| 66 | 58 | #define H_LAYERLEVEL 3 //!< Select include file. |
| 67 | 59 | #endif |
| 68 | 60 | #include "main.h" |
| 69 | 61 | |
| 62 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 63 | + #define MAX_CONSOLELEN 78 //!< デバック用コンソールの文字数(行) | |
| 64 | + #define MAX_CONSOLELINES 12 //!< デバック用コンソールの行数 | |
| 65 | + #define CONSOLE_PROMPT ">" //!< デバック用コンソールのプロンプト | |
| 66 | +#endif | |
| 67 | + | |
| 70 | 68 | int InitGame(WindowControl *WindowCtrl); |
| 71 | 69 | void CleanupGame(); |
| 72 | 70 |
| @@ -66,6 +66,7 @@ | ||
| 66 | 66 | |
| 67 | 67 | #define ENABLE_BUG_HUMANWEAPON //!< 範囲外の人・武器種類番号を用いたバグを再現する(コメント化で無効) |
| 68 | 68 | #define ENABLE_BUG_TEAMID //!< チーム番号を負数に設定した際のバグを再現する(コメント化で無効) |
| 69 | +#define ENABLE_DEBUGCONSOLE //!< @brief デバック用コンソールの有効化(コメント化で機能無効) | |
| 69 | 70 | #define ENABLE_DEBUGLOG //!< @brief デバック用ログ出力の有効化(コメント化で機能無効) |
| 70 | 71 | //#define PATH_DELIMITER_SLASH //!< パス区切り文字を、'\'から‘/’へ変換する。 |
| 71 | 72 |