dxx-rebirth/common/ui/ui.cpp

95 lines
2.1 KiB
C++
Raw Normal View History

2006-03-20 17:12:09 +00:00
/*
2014-06-01 17:55:23 +00:00
* Portions of this file are copyright Rebirth contributors and licensed as
* described in COPYING.txt.
* Portions of this file are copyright Parallax Software and licensed
* according to the Parallax license below.
* See COPYING.txt for license details.
2006-03-20 17:12:09 +00:00
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
/*
*
* UI init and close functions.
*
*/
2006-03-20 17:12:09 +00:00
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
2012-07-01 02:54:33 +00:00
#include "maths.h"
2006-03-20 17:12:09 +00:00
#include "pstypes.h"
#include "gr.h"
#include "key.h"
#include "ui.h"
#include "mouse.h"
#include "dxxerror.h"
2006-03-20 17:12:09 +00:00
2015-12-13 18:00:49 +00:00
namespace dcx {
2015-12-05 22:57:24 +00:00
2006-03-20 17:12:09 +00:00
static int Initialized = 0;
unsigned char CBLACK,CGREY,CWHITE,CBRIGHT,CRED;
grs_font_ptr ui_small_font;
2006-03-20 17:12:09 +00:00
int ui_init()
2006-03-20 17:12:09 +00:00
{
if (Initialized) return 1;
2006-03-20 17:12:09 +00:00
2014-07-20 03:48:27 +00:00
const grs_font *org_font = grd_curcanv->cv_font;
2017-03-11 19:56:22 +00:00
ui_small_font = gr_init_font(*grd_curcanv, "pc6x8.fnt");
if (!ui_small_font)
{
Warning("Could not find pc6x8.fnt");
return 0;
}
2006-03-20 17:12:09 +00:00
grd_curcanv->cv_font =org_font;
CBLACK = gr_find_closest_color( 1, 1, 1 );
CGREY = gr_find_closest_color( 45, 45, 45 );
CWHITE = gr_find_closest_color( 50, 50, 50 );
CBRIGHT = gr_find_closest_color( 58, 58, 58 );
CRED = gr_find_closest_color( 63, 0, 0 );
2006-03-20 17:12:09 +00:00
//key_init();
2017-02-11 21:42:32 +00:00
gr_set_fontcolor(*grd_curcanv, CBLACK, CWHITE);
2006-03-20 17:12:09 +00:00
ui_pad_init();
atexit(ui_close );
Initialized = 1;
return 1;
2006-03-20 17:12:09 +00:00
}
void ui_close()
{
if (Initialized)
{
Initialized = 0;
menubar_close();
2006-03-20 17:12:09 +00:00
ui_pad_close();
ui_small_font.reset();
2006-03-20 17:12:09 +00:00
}
return;
}
2015-12-05 22:57:24 +00:00
}