File: ivis_linktest.cpp

package info (click to toggle)
warzone2100 4.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 660,348 kB
  • sloc: cpp: 675,711; ansic: 387,204; javascript: 75,107; python: 16,628; php: 4,294; sh: 3,941; makefile: 2,330; lisp: 1,492; cs: 489; xml: 404; perl: 224; ruby: 156; java: 89
file content (104 lines) | stat: -rw-r--r-- 2,004 bytes parent folder | download | duplicates (6)
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
96
97
98
99
100
101
102
103
104
#include "lib/framework/wzglobal.h"
#include "lib/framework/types.h"
#include "lib/framework/frame.h"
#include "lib/framework/wzapp.h"
#include "lib/framework/input.h"
#include "lib/ivis_opengl/screen.h"
#include "lib/ivis_opengl/piemode.h"
#include "lib/ivis_opengl/pieclip.h"
#include "lib/ivis_opengl/textdraw.h"

#include "src/console.h" // HACK

// --- console dummy implementations ---
// this should be implemented within ivis lib

#define MAX_CONSOLE_TMP_STRING_LENGTH	(255)
char ConsoleString[MAX_CONSOLE_TMP_STRING_LENGTH];
int titleMode;

bool addConsoleMessage(const char *Text, CONSOLE_TEXT_JUSTIFICATION jusType, SDWORD player, bool team)
{
	return true;
}

// --- misc dummy implementations ---

UDWORD realTime; // from gtime

bool bMultiPlayer; // FIXME, really should not access this from ivis lib

void addDumpInfo(const char *inbuffer)
{
}

utf_32_char* UTF8toUTF32(char const*, unsigned long*)
{
	return NULL;
}


bool war_getFullscreen()
{
	return false;
}

bool war_GetColouredCursor()
{
	return false;
}

bool war_GetVsync()
{
	return false;
}

void war_SetColouredCursor(bool enabled)
{
}

int war_GetScreen()
{
	return 0;
}

// --- end linking hacks ---

void mainLoop()
{
	iV_DrawTextRotated("Press ESC to exit.", 100, 100, 0.0f);
	pie_ScreenFlip(CLEAR_BLACK);
	frameUpdate(); // General housekeeping

	if (keyPressed(KEY_ESC))
	{
		inputLoseFocus();               // remove it from input stream
		wzQuit();
	}
}

int realmain(int argc, char **argv)
{
	wzMain(argc, argv);
	debug_init();
	debug_register_callback(debug_callback_stderr, NULL, NULL, NULL);
	pie_SetVideoBufferWidth(800);
	pie_SetVideoBufferHeight(600);
	if (!wzMainScreenSetup(0, false, true))
	{
		fprintf(stderr, "Failed to initialize graphics\n");
		return EXIT_FAILURE;
	}
	frameInitialise();
	screenInitialise();
	iV_font("DejaVu Sans", "Book", "Bold");
	iV_TextInit();

	wzMainEventLoop(); // enter main loop

	iV_TextShutdown();
	frameShutDown();
	screenShutDown();
	wzShutdown();
	return EXIT_SUCCESS;
}