Ejemplo n.º 1
0
void KeyBaseCase::showErrorScreen(int errorCode)
{
	MAExtent e = maGetScrSize();
	Dimensions screen;
	screen.width = EXTENT_X(e);
	screen.height = EXTENT_Y(e);
	maSetClipRect(0, 0, screen.width, screen.height);

	maSetColor(BLACK);
	maFillRect(0, 0, screen.width, screen.height);

	int oldCol = maSetColor(0xff0000);
	const char* testName = name.c_str();
	maDrawText(4, 0, testName);

	int testNameHeight = EXTENT_Y(maGetTextSize(testName));

	if(FUNC_OUT_OF_MEMORY_ALLOC == errorCode)
		maDrawText(4, testNameHeight+2, "Out of Memory");
	else if(FUNC_OUT_OF_MEMORY_RESOURCE == errorCode)
		maDrawText(4, testNameHeight+2, "Couldn't create resource");
	else if(FUNC_SYSCALL_ERROR == errorCode)
		maDrawText(4, testNameHeight+2, "A syscall wasn't called correctly");
	else if(FUNC_SYSCALL_NOT_SUPPORTED == errorCode)
		maDrawText(4, testNameHeight+2, "Unsupported feature");
	else
		maDrawText(4, testNameHeight+2, "Unknown error!");

	maDrawText(4, testNameHeight*2+4, "press key or screen to continue");

	maUpdateScreen();
	maSetColor(oldCol);	
}
Ejemplo n.º 2
0
	int renderCurrent()
	{
		int h = 1;
		MAExtent e = maGetScrSize();
		Dimensions screen;
		screen.width = EXTENT_X(e);
		screen.height = EXTENT_Y(e);

		maSetClipRect(0, 0, screen.width, screen.height);
		maSetColor(BLACK);
		maFillRect(0, 0, screen.width, screen.height);

		maSetColor(0xffffff);
		sprintf(buff, "Write the following string");
		mExtent = maGetTextSize(buff);


		maDrawText(1,h,buff);
		h+= EXTENT_Y(mExtent);

		sprintf(buff, "%s", matchString.c_str());
		mExtent = maGetTextSize(buff);

		maDrawText(1,h,buff);
		h+=EXTENT_Y(mExtent);

		sprintf(buff, "end");
		mExtent = maGetTextSize(buff);
		maDrawText(screen.width - EXTENT_X(mExtent),screen.height-EXTENT_Y(mExtent),buff);

		return h;
	}
Ejemplo n.º 3
0
void InitConsole(void)
{
	int i;
	char string[128];

	sConsole.screenSize = maGetScrSize();
	maSetClipRect(0, 0, EXTENT_X(sConsole.screenSize), EXTENT_Y(sConsole.screenSize));

	//sConsole.fontHeight = EXTENT_Y(maGetTextSize("gl"));
	
	// this is actually even more safe:
	for(i = 0; i < 95; i++) string[i] = i + 32;
	string[127] = 0;
	sConsole.fontHeight = EXTENT_Y(maGetTextSize(string));

	sConsole.height = EXTENT_Y(sConsole.screenSize) / sConsole.fontHeight;
	sConsole.cursorPos.x = 0;
	sConsole.cursorPos.y = sConsole.height - 1;
	sConsole.firstLine = 0;
	sConsole.postponedLineFeed = 0;

	sConsole.lines = (ConLine*)malloc(sizeof(ConLine) * sConsole.height);
	for (i = 0;  i < sConsole.height;  i++)
		memset(sConsole.lines[i].line, 0, sizeof(ConLine));

	sConsole.initialized = 1;
}
Ejemplo n.º 4
0
void clearScreen(int color) {
	MAExtent e = maGetScrSize();
	Dimensions screen;
	screen.width = EXTENT_X(e);
	screen.height = EXTENT_Y(e);

	maSetClipRect(0, 0, screen.width, screen.height);
	int oldCol = maSetColor(color);
	maFillRect(0, 0, screen.width, screen.height);
	maSetColor(oldCol);
}
Ejemplo n.º 5
0
void DisplayConsole(void)
{
	int n, index;

	if (gConsoleDisplay == 0)
		return;

	maSetClipRect(0, 0, EXTENT_X(sConsole.screenSize), EXTENT_Y(sConsole.screenSize));

	if(gConsoleDrawBackground) {
		maSetColor(gConsoleBackgroundColor);
		maFillRect(0, 0, EXTENT_X(sConsole.screenSize), EXTENT_Y(sConsole.screenSize));
	}
	
	maSetColor(gConsoleTextColor);
	for (n = 0;  n < sConsole.height;  n++)
	{
		index = (n + sConsole.firstLine) % sConsole.height;
		maDrawTextW(0, n * sConsole.fontHeight, sConsole.lines[index].line);
	}

	maUpdateScreen();
}
Ejemplo n.º 6
0
static void soft_setClipRect(int x, int y, int w, int h) {
	maSetClipRect(x, y, w, h);
}