1
General / Transparency Background
« on: November 05, 2010, 09:52:42 pm »
Ok, thanks.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
void Network(void*)
{
unsigned int Port = 2435;
// Ask for server address
sf::IPAddress ServerAddress;
do
{
ServerAddress = "localhost";
}
while (!ServerAddress.IsValid());
std::cin.ignore(10000, '\n');
// Create a socket for exchanging data with the server
sf::SocketTCP Socket;
// Connect to the server
if (Socket.Connect(Port, ServerAddress) != sf::Socket::Done)
return;
// Send messages until we are disconnected
bool Connected = true;
/*
while (Connected)
{
// Let the user write a message
std::string Message;
std::cout << "Say something to the server : ";
std::getline(std::cin, Message);
// Send it to the server
sf::Packet Packet;
Packet << Message;
Connected = (Socket.Send(Packet) == sf::Socket::Done);
}
*/
// Close the socket
Socket.Close();
}
And now some important main source:
// Einstellungen laden
int VideoX = 1024;
int VideoY = 768;
sf::Thread NetworkThread(&Network);
NetworkThread.Launch();
ifstream LoadConfig("Data\\Config.txt");
// LoadConfig >> VideoX;
// LoadConfig >> VideoY;
// Fenster erstellen
sf::RenderWindow App(sf::VideoMode(VideoX, VideoY, 32), "Window", sf::Style::Close);
#include <SFML/Window.hpp>
int main()
{
// Fenster erstellen
sf::Window App(sf::VideoMode(800, 600, 32), "OpenGL");
glClearDepth(1.f);
glClearColor(0.f, 0.f, 0.f, 0.f);
// Z - Buffer
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
// Projektion
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.f, 1.f, 1.f, 500.f);
// Hauptschleife
while (App.IsOpened())
{
sf::Event Event;
while (App.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
{
App.Close();
}
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
{
App.Close();
}
if (Event.Type == sf::Event::Resized)
{
glViewport(0, 0, Event.Size.Width, Event.Size.Height);
}
}
App.SetActive();
// Fenster leeren
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.f, 0.f, -200.f);
glBegin(GL_POLYGON);
glVertex3f (0, 0, 0);
glVertex3f (25, 0, 0);
glVertex3f (0, 0, 25);
glVertex3f (25, 0, 25);
glEnd();
App.Display();
}
return EXIT_SUCCESS;
}
<?php
$mysql_host = $_GET['Server'];
$mysql_user = $_GET['Username'];
$mysql_pass = $_GET['Password'];
$mysql_db = $_GET['Database'];
@mysql_connect($mysql_host, $mysql_user, $mysql_pass) OR
die ("Error: MySQL failed");
@mysql_select_db($mysql_db) OR
die ("Error: MySQL failed");
echo ("Success");
?>
sf::Http Http;
FullPHPAddress = "localhost";
FullPHPAddress = FullPHPAddress + "\\Init.php?Server=";
FullPHPAddress = FullPHPAddress + myMySQLAddress.ToString();
FullPHPAddress = FullPHPAddress + "&Username=";
FullPHPAddress = FullPHPAddress + myMySQLUsername;
FullPHPAddress = FullPHPAddress + "&Password=";
FullPHPAddress = FullPHPAddress + myMySQLPassword;
FullPHPAddress = FullPHPAddress + "&Database=Database";
Http.SetHost(FullPHPAddress);
sf::Http::Request Request;
Request.SetMethod(sf::Http::Request::Get);
Request.SetURI("/");
Request.SetBody("");
Request.SetHttpVersion(1, 0);
Request.SetField("From", "ipod.leon@googlemail.com");
sf::Http::Response Page = Http.SendRequest(Request);
if (Page.GetStatus() != 200)
{
StartErrorIndex += 1;
StartErrorIndex[StartErrorIndexState] = "Error: PHP failed!\n";
SystemOK = false;
}
if (Page.GetBody() == "Error: MySQL failed")
{
StartErrorIndex += 1;
StartErrorIndex[StartErrorIndexState] = "Error: MySQL failed!\n";
SystemOK = false;
}