-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJC-Notes.txt
39 lines (20 loc) · 1.17 KB
/
JC-Notes.txt
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
Polling is the process where the computer or controlling device waits for an external device to check for its readiness or state
Events are generated by the user or the system and can include keys being pressed, the mouse moving, the window being closed, or a timer alarm occurring. Events can be handled with polling or callbacks.
In polling, we will ask the system if any events have occurred
There can be multiple events in the queue. You should loop until all events have been handled. You can fetch events with Window::pollEvent().
This method returns false when there are no events in the queue.
sf::Event event;
while(window.pollEvent(event))
{
//check event type and handle
}
------------------------------------------------------------------------------------------------
Regular Entity + Texture = Sprite
Loading a texture
Since the only role of a texture is to be loaded and mapped to graphical entities, almost all its functions are about loading and updating it.
The most common way of loading a texture is from an image file on disk, which is done with the loadFromFile function.
sf::Texture texture;
if (!texture.loadFromFile("image.png"))
{
// error...
}