project64/Source/Project64-video/Debugger.cpp

65 lines
2.2 KiB
C++
Raw Normal View History

2017-04-26 10:23:36 +00:00
/***************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
* Copyright (C) 2002 Dave2001 *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#include <stdarg.h>
2016-01-28 20:00:13 +00:00
#include <string.h>
#include "Gfx_1.3.h"
2013-04-04 21:22:19 +00:00
#include "Util.h"
#include "Debugger.h"
#define SX(x) ((x)*rdp.scale_1024)
#define SY(x) ((x)*rdp.scale_768)
//
// output - output debugger text
//
void output (float x, float y, int scale, const char *fmt, ...)
{
va_list ap;
va_start(ap,fmt);
vsprintf(out_buf, fmt, ap);
va_end(ap);
2016-01-20 06:17:45 +00:00
uint8_t c,r;
for (uint32_t i=0; i<strlen(out_buf); i++)
2013-04-04 21:22:19 +00:00
{
c = ((out_buf[i]-32) & 0x1F) * 8;//<< 3;
r = (((out_buf[i]-32) & 0xE0) >> 5) * 16;//<< 4;
VERTEX v[4] = { { SX(x), SY(768-y), 1, 1, (float)c, r+16.0f, 0, 0, {0, 0, 0, 0} },
{ SX(x+8), SY(768-y), 1, 1, c+8.0f, r+16.0f, 0, 0, {0, 0, 0, 0} },
{ SX(x), SY(768-y-16), 1, 1, (float)c, (float)r, 0, 0, {0, 0, 0, 0} },
{ SX(x+8), SY(768-y-16), 1, 1, c+8.0f, (float)r, 0, 0, {0, 0, 0, 0} }
2013-04-04 21:22:19 +00:00
};
if (!scale)
{
v[0].x = x;
v[0].y = y;
v[1].x = x+8;
v[1].y = y;
v[2].x = x;
v[2].y = y-16;
v[3].x = x+8;
v[3].y = y-16;
}
ConvertCoordsKeep (v, 4);
grDrawTriangle (&v[0], &v[1], &v[2]);
grDrawTriangle (&v[1], &v[3], &v[2]);
x+=8;
}
}