-
Notifications
You must be signed in to change notification settings - Fork 39
/
EngineCallback.cpp
95 lines (73 loc) · 2.37 KB
/
EngineCallback.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
enginecallback.cpp - actual engine callbacks
Copyright (C) 2017 a1batross
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#include "extdll_menu.h"
#include "BaseMenu.h"
#include "Utils.h"
void EngFuncs::PIC_Set( HIMAGE hPic, int r, int g, int b, int a)
{
if( uiStatic.enableAlphaFactor )
a *= uiStatic.alphaFactor;
engfuncs.pfnPIC_Set( hPic, r, g, b, a );
}
void EngFuncs::FillRGBA(int x, int y, int width, int height, int r, int g, int b, int a)
{
if( uiStatic.enableAlphaFactor )
a *= uiStatic.alphaFactor;
engfuncs.pfnFillRGBA( x, y, width, height, r, g, b, a );
}
void EngFuncs::DrawLogo( const char *filename, float x, float y, float width, float height )
{
if( uiStatic.enableAlphaFactor )
return;
engfuncs.pfnDrawLogo( filename, x, y, width, height );
}
void EngFuncs::DrawCharacter(int x, int y, int width, int height, int ch, int ulRGBA, HIMAGE hFont)
{
engfuncs.pfnDrawCharacter( x, y, width, height, ch, ulRGBA, hFont );
}
static unsigned int color;
void EngFuncs::DrawSetTextColor(int r, int g, int b, int alpha)
{
color = PackRGBA( r, g, b, alpha );
}
int EngFuncs::DrawConsoleString(int x, int y, const char *string)
{
Point pt( x, y );
Size sz;
int charSz;
sz.w = ScreenWidth - pt.x;
sz.h = ScreenHeight - pt.y;
charSz = g_FontMgr->GetFontTall( uiStatic.hConsoleFont );
return UI_DrawString( uiStatic.hConsoleFont, pt, sz, string, color, charSz, QM_TOPLEFT );
}
void EngFuncs::ConsoleStringLen(const char *string, int *length, int *height)
{
g_FontMgr->GetTextSize( uiStatic.hConsoleFont, string, length, height );
}
int EngFuncs::ConsoleCharacterHeight()
{
return g_FontMgr->GetFontTall( uiStatic.hConsoleFont );
}
// We have full unicode support now
int EngFuncs::UtfProcessChar(int ch)
{
return Con_UtfProcessChar( ch );
}
int EngFuncs::UtfMoveLeft(const char *str, int pos)
{
return Con_UtfMoveLeft( str, pos );
}
int EngFuncs::UtfMoveRight(const char *str, int pos, int length)
{
return Con_UtfMoveRight( str, pos, length );
}