View difference between Paste ID: GDFDsvW5 and CG8gc0UK
SHOW: | | - or go back to the newest paste.
1
/*
2-
	Demo na podstawie projektu SQUARE:
2+
	Demo 2 na podstawie projektu SQUARE:
3
	https://github.com/sheadovas/SQUARE/blob/master/_Window.cpp
4
	https://github.com/sheadovas/SQUARE/blob/master/_Window.h
5
*/
6
7-
Event event;
7+
Text text;
8
... // <- ustawienie czcionki, pozycji, etc
9
10-
if (event.type == Event::TextEntered)
10+
11
RenderWindow window(...);
12-
	if (event.text.unicode < 128)
12+
13-
		data += static_cast<char>(event.text.unicode);
13+
while(window.isOpen())
14
{
15
	Event event;
16
	
17
	while(window.pollEvent(event)
18
	{
19
		if (event.type == Event::TextEntered)
20
		{
21
			if (event.text.unicode < 128)
22
				data += static_cast<char>(event.text.unicode);
23
			text.setString(data);
24
		}
25
	}
26
	... // <- czyszczenie, rysowanie innych ewentualnych obiektów
27
	window.draw(text); // rysowanie tekstu
28
	...
29
	window.display();
30
}