Watch Star Fork

git123hub / luajit-testC/C++

暂无描述
克隆/下载
一键复制 编辑 原始数据 按行查看 历史
lua-conxlat.cpp 2.15 KB My main account 提交于 2018-01-15 14:25 . Add files via upload
#include "console-common.h"
#include "lua-font.h"
#include "lua-conwin.h"
#include "lua-extra-attr.h"
#include <algorithm>
BLINK_FLAGS_TYPE *sdl_blinking_flags_0 = NULL; // *luacon_curr_pattern_0 = NULL;
int luacon_blinking_period[2] = {30, 30};
#define enum_console(i, j) { for (j = 0; j < YCHRS; j++) for (i = 0; i < XCHRS; i++) {
#define enum_console_end }}
#if defined(__GNUC__) || defined(_MSC_VER)
__declspec(noinline)
#endif
void sdl_translate_map(int32_t* text_buf, unsigned int * vid, int flags)
{
int fg, bg, chr, src = 0;
int i, j, i2, j2;
fontdata_column_t b;
fontdata_t b_ptr;
enum_console(i, j)
chr = text_buf[src] & ((1 << FONT_NUM_CHAR_BITS) - 1);
fg = text_buf[src+1];
bg = text_buf[src+2];
b_ptr = ascii_font_ptr[chr];
if (b_ptr != NULL)
for (i2 = 0; b = b_ptr[i2], i2 < CHRW; i2++)
for (j2 = 0; j2 < CHRH; j2++)
vid[(i*CHRW+i2)+(XRES)*(j*CHRH+j2)] = (b & 1<<(15-j2) ? fg : bg);
else for (j2 = 0; j2 < CHRH; j2++)
std::fill_n(&vid[(i*CHRW)+(XRES)*(j*CHRH+j2)], CHRW, bg);
src += (SSKIP/4);
enum_console_end
if (sdl_blinking_flags_0 != NULL)
{
static int blink_timeout = 0;
static bool blink_state = false;
if (blink_timeout)
blink_timeout--;
else
blink_timeout = luacon_blinking_period[blink_state ? 0 : 1],
blink_state = !blink_state;
int oset = 0;
enum_console(i, j)
int k = sdl_blinking_flags_0[j * XCHRS + i];
if (k && !(k & BFLAG_DISABLE))
{
if ((k & BFLAG_BLINKING) && blink_state)
{
int color = text_buf[oset + 2];
for (j2 = 0; j2 < CHRH; j2++)
std::fill_n(&vid[(i*CHRW)+(XRES)*(j*CHRH+j2)], CHRW, color);
}
int fc = text_buf[oset + 1];
if (k & BFLAG_UNDERSC)
std::fill_n(&vid[(i*CHRW)+(XRES)*((j+1)*CHRH-1)], CHRW, fc);
if (k & BFLAG_OVERLINE)
std::fill_n(&vid[(i*CHRW)+(XRES)*(j*CHRH)], CHRW, fc);
if (k & BFLAG_LVERTICAL)
for (j2 = 0; j2 < CHRH; j2++)
vid[(i*CHRW)+(XRES)*(j*CHRH+j2)] = fc;
if (k & BFLAG_RVERTICAL)
for (j2 = 0; j2 < CHRH; j2++)
vid[((i+1)*CHRW-1)+(XRES)*(j*CHRH+j2)] = fc;
}
oset += (SSKIP/4);
enum_console_end
}
}

评论 ( 0 )

你可以在登录后,对此项目发表评论

Resume_pages Pages_close