Beispiel #1
0
DebugInfo::DebugInfo() : Socket()
{
    Connect("debug.rttr.info", 4123, false, (Socket::PROXY_TYPE)SETTINGS.proxy.typ, SETTINGS.proxy.proxy, SETTINGS.proxy.port); //-V807

    Send("RTTRDBG", 7);

    // Protocol Version
    SendUnsigned(0x00000001);

    // OS
#ifdef _WIN32
    SendString("WIN");
    // TODO: These should be based on uname(3) output.
#elif defined __APPLE__
    SendString("MAC");
#elif defined __FreeBSD__
    SendString("BSD");
#else
    SendString("LNX");
#endif

    // Bits
    SendUnsigned(sizeof(void*) << 3);

    SendString(GetWindowVersion());
    SendString(GetWindowRevision());

    SendUnsigned(GAMECLIENT.GetGFNumber());
}
Beispiel #2
0
/**
 *
 *  @author OLiver
 */
void SavedFile::WriteVersion(BinaryFile& file, unsigned int signature_length, const char* signature, unsigned short version)
{
    // Signatur schreiben
    file.WriteRawData(signature, signature_length);

    // Version vom Programm reinschreiben (mal 0 mit reinschreiben, damits ne runde 8 ergibt!)
    file.WriteRawData(GetWindowRevision(), 8);

    // Version des Save-Formats
    file.WriteUnsignedShort(version);
}
Beispiel #3
0
/**
 *  Erstellt das Fenster mit entsprechenden Werten.
 *
 *  @param[in] width      Breite des Fensters
 *  @param[in] height     Höhe des Fensters
 *  @param[in] fullscreen Vollbildmodus ja oder nein
 *
 *  @return @p true bei Erfolg, @p false bei Fehler
 */
bool VideoSDL::CreateScreen(unsigned short width, unsigned short height, const bool fullscreen)
{
    char title[512];

    if(!initialized)
        return false;

    // TODO: Icon setzen


    // GL-Attribute setzen
    SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1);

#ifdef _WIN32
    // das spinnt ja total unter windows ...
    this->isFullscreen_ = false;
#else
    this->isFullscreen_ = fullscreen;
#endif

    // Videomodus setzen
    if(!(screen = SDL_SetVideoMode(width, height, 32, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_OPENGL | (this->isFullscreen_ ? SDL_FULLSCREEN : SDL_RESIZABLE))))
    {
        fprintf(stderr, "%s\n", SDL_GetError());
        return false;
    }

    sprintf(title, "%s - v%s-%s", GetWindowTitle(), GetWindowVersion(), GetWindowRevision());
    SDL_WM_SetCaption(title, 0);

#ifdef _WIN32
    SetWindowTextA(GetConsoleWindow(), title);
#endif

    std::fill(keyboard.begin(), keyboard.end(), false);

    this->screenWidth  = width;
    this->screenHeight = height;

    SDL_ShowCursor(SDL_DISABLE);

    return true;
}
Beispiel #4
0
/**
 *  Konstruktor von @p dskSinglePlayer.
 *
 *  @author OLiver
 *  @author FloSoft
 */
dskSinglePlayer::dskSinglePlayer(void) : Desktop(LOADER.GetImageN("menu", 0))
{
    // Version
    AddVarText(0, 0, 600, _("Return To The Roots - v%s-%s"), COLOR_YELLOW, 0 | glArchivItem_Font::DF_BOTTOM, NormalFont, 2, GetWindowVersion(), GetWindowRevision());
    // URL
    AddText(1, 400, 600, _("http://www.siedler25.org"), COLOR_GREEN, glArchivItem_Font::DF_CENTER | glArchivItem_Font::DF_BOTTOM, NormalFont);
    // Copyright
    AddVarText(2, 800, 600, _("\xA9 2005 - %s Settlers Freaks"), COLOR_YELLOW, glArchivItem_Font::DF_RIGHT | glArchivItem_Font::DF_BOTTOM, NormalFont, 1, GetCurrentYear());

    // "Letztes Spiel fortsetzen"
    AddTextButton(3, 115, 180, 220, 22, TC_GREEN2, _("Resume last game"), NormalFont);
    // "Replay abspielen"
    AddTextButton(4, 115, 220, 220, 22, TC_GREEN2, _("Play Replay"), NormalFont);
    // "Kampagne"
    AddTextButton(5, 115, 260, 220, 22, TC_GREEN2, _("Campaign"), NormalFont);
    // "Freies Spiel"
    AddTextButton(6, 115, 290, 220, 22, TC_GREEN2, _("Unlimited Play"), NormalFont);
    // "Spiel laden"
    AddTextButton(7, 115, 320, 220, 22, TC_GREEN2, _("Load game"), NormalFont);
    // "Zurück"
    AddTextButton(8, 115, 360, 220, 22, TC_RED1, _("Back"), NormalFont);

    AddImage(11, 20, 20, LOADER.GetImageN("logo", 0));
}
Beispiel #5
0
/** 
 *  Erstellt das Fenster mit entsprechenden Werten.
 *
 *  @param[in] width      Breite des Fensters
 *  @param[in] height     Höhe des Fensters
 *  @param[in] fullscreen Vollbildmodus ja oder nein
 *
 *  @return @p true bei Erfolg, @p false bei Fehler
 *
 *  @bug Hardwarecursor ist bei Fenstermodus sichtbar,
 *       Cursor deaktivieren ist fehlerhaft
 *
 *  @author FloSoft
 */
bool VideoWinAPI::CreateScreen(unsigned short width, unsigned short height, const bool fullscreen)
{
	char title[512];

	if(!initialized)
		return false;

	LPWSTR wTitle;
	AnsiToUtf8(wTitle, GetWindowTitle());

	WNDCLASSW  wc;
	wc.style			= CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
	wc.lpfnWndProc		= WindowProc;
	wc.cbClsExtra	    = 0;
	wc.cbWndExtra	    = 0;
	wc.hInstance	    = GetModuleHandle(NULL);
	wc.hIcon			= LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_SYMBOL));
	wc.hCursor			= NULL;
	wc.hbrBackground	= NULL;
	wc.lpszMenuName		= NULL;
	wc.lpszClassName	= wTitle;

	// Fensterklasse registrieren
	if (!RegisterClassW(&wc))
		return false;

	DWORD dwExStyle	= WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
	DWORD dwStyle	= WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX;

	if(fullscreen)
	{
		dwExStyle	= WS_EX_APPWINDOW;
		dwStyle		= WS_POPUP;

		EnumDisplaySettings(0, ENUM_CURRENT_SETTINGS, &dm_prev);
	}
	else
	{
		// Bei Fensteranwendung die Breiten und Hoehen der Fensterrahmen, Titelleiste draufaddieren
		width += 2*GetSystemMetrics(SM_CXFIXEDFRAME);
		height+= 2*GetSystemMetrics(SM_CXFIXEDFRAME) + GetSystemMetrics(SM_CYCAPTION);
	}

	// Fenster erstellen
	screen = CreateWindowExW(dwExStyle, wTitle, wTitle, dwStyle, CW_USEDEFAULT, CW_USEDEFAULT, width, height, NULL, NULL, GetModuleHandle(NULL), NULL);

	delete[] wTitle;

	if(screen == NULL)
		return false;

	SetClipboardViewer(screen);

	sprintf(title, "%s - v%s-%s", GetWindowTitle(), GetWindowVersion(), GetWindowRevision());

	AnsiToUtf8(wTitle, title);

	SetWindowTextW(screen, wTitle);
	SetWindowTextW(GetConsoleWindow(), wTitle);

	delete[] wTitle;

	// Pixelformat zuweisen
	GLuint PixelFormat;
	static PIXELFORMATDESCRIPTOR pfd =
	{
		sizeof(PIXELFORMATDESCRIPTOR),
		1,
		PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
		PFD_TYPE_RGBA,
		8, // 8 Bit
		8, // red
		0,
		8, // green
		0,
		8, // blue
		0,
		8, // alpha
		0,
		0,
		0,
		0,
		0,
		0,
		32, // 32 Bit
		0,
		0,
		PFD_MAIN_PLANE,
		0,
		0,
		0,
		0
	};

	screen_dc = GetDC(screen);
	if(screen_dc == NULL)
		return false;

	// Pixelformat auswaehlen
	PixelFormat = ChoosePixelFormat(screen_dc, &pfd);
	if(PixelFormat == 0)
		return false;

	// Pixelformat zuweisen
	if(!SetPixelFormat(screen_dc, PixelFormat, &pfd))
		return false;

	// Renderingkontext erstellen
	screen_rc = wglCreateContext(screen_dc);
	if(screen_rc == NULL)
		return false;

	// Renderingkontext aktivieren
	if(!wglMakeCurrent(screen_dc, screen_rc))
		return false;

	// Mauscursor ausblenden
	ShowCursor(FALSE);

	// Bei Fullscreen Aufloesung umstellen
	if(fullscreen)
	{
		// Aktuelle Framerate holen und die spaeter dann benutzen
		DEVMODE prev;
		EnumDisplaySettings(0, ENUM_CURRENT_SETTINGS, &prev);

		DEVMODE dm;
		memset(&dm, 0, sizeof(dm));
		dm.dmSize = sizeof(dm);
		dm.dmFields = DM_DISPLAYFREQUENCY | DM_PELSWIDTH | DM_PELSHEIGHT;
		dm.dmDisplayFrequency = prev.dmDisplayFrequency;
		dm.dmPelsWidth = width;
		dm.dmPelsHeight = height;

		ChangeDisplaySettings(&dm, CDS_FULLSCREEN);
	}

	this->screenWidth  = width;
	this->screenHeight = height;
	this->fullscreen = fullscreen;

	// Das Fenster anzeigen
	ShowWindow(screen, SW_SHOW);
	// Das Fenster in den Vordergrund rcken
	SetForegroundWindow(screen);
	// Dem Fenster den Eingabefokus geben
	SetFocus(screen);

	return true;
}
Beispiel #6
0
/**
 *  Konstruktor von @p dskMainMenu.
 *
 *  @author OLiver
 *  @author FloSoft
 */
dskMainMenu::dskMainMenu(void) : Desktop(LOADER.GetImageN("menu", 0))
{
    // Version
    AddVarText(0, 0, 600, _("Return To The Roots - v%s-%s"), COLOR_YELLOW, 0 | glArchivItem_Font::DF_BOTTOM, NormalFont, 2, GetWindowVersion(), GetWindowRevision());
    // URL
    AddText(1, 400, 600, _("http://www.siedler25.org"), COLOR_GREEN, glArchivItem_Font::DF_CENTER | glArchivItem_Font::DF_BOTTOM, NormalFont);
    // Copyright
    AddVarText(2, 800, 600, _("© 2005 - %s Settlers Freaks"), COLOR_YELLOW, glArchivItem_Font::DF_RIGHT | glArchivItem_Font::DF_BOTTOM, NormalFont, 1, GetCurrentYear());

    // "Einzelspieler"
    AddTextButton(4, 115, 180, 220, 22, TC_GREEN2, _("Singleplayer"), NormalFont);
    // "Mehrspieler"
    AddTextButton(5, 115, 210, 220, 22, TC_GREEN2, _("Multiplayer"), NormalFont);
    // "Optionen"
    AddTextButton(6, 115, 250, 220, 22, TC_GREEN2, _("Options"), NormalFont);
    // "Intro"
    AddTextButton(7, 115, 280, 220, 22, TC_GREEN2, _("Intro"), NormalFont);
    // "ReadMe"
    AddTextButton(10, 115, 310, 220, 22, TC_GREEN2, _("Readme"), NormalFont);
    // "Credits"
    AddTextButton(8, 115, 340, 220, 22, TC_GREEN2, _("Credits"), NormalFont);
    // "Programm verlassen"
    AddTextButton(9, 115, 390, 220, 22, TC_RED1, _("Quit program"), NormalFont);

    AddImage(11, 20, 20, LOADER.GetImageN("logo", 0));

    if (SETTINGS.global.submit_debug_data == 0)
    {
        AddTimer(20, 250);
    }

    /*AddText(20, 50, 450, _("Font Test"), COLOR_YELLOW, glArchivItem_Font::DF_LEFT, SmallFont);
    AddText(21, 50, 470, _("Font Test"), COLOR_YELLOW, glArchivItem_Font::DF_LEFT, NormalFont);
    AddText(22, 50, 490, _("Font Test"), COLOR_YELLOW, glArchivItem_Font::DF_LEFT, LargeFont);*/
    //  !\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz\\_ABCDEFGHIJKLMNOPQRSTUVWXYZÇüéâäàåçêëèïîì©ÄÅôöòûùÖÜáíóúñ
}