Viewing 1 to 10 of 946 items
Sometimes, audio data cannot be integrally loaded in memory. For example, the sound can be aquired from the network, or on the fly from a file that is too big. In such cases, you must be able to play the sound while you load it, and still give the illusion that you play it in one block. This is what is called "streaming".
SFML provides a base cl...
Read More
You may ask, "what's the difference between a music and a sound ?". Well, a music is just a longer sound. But it makes a big difference in audio programming. The same difference that requires MP3 or OGG compression for your musics. As we've learnt in the previous tutorial, uncompressed sound data is made of samples, which are (in SFML) 16 bits sign...
Read More
Playing a sound is the easiest task of the SFML audio package. However it involves two entities : the sound data, and the sound instance. In fact it acts exactly like images and sprites in the graphics package....
Read More
Generating pseudo-random numbers is not hard, especially with the rand and srand functions from the standard library. But you always end up writing helper functions, for getting a random number in a specific range, getting a float random number, etc. That's why SFML provides a helper class, sf::Randomizer, that defines some helper functions....
Read More
First, I must say that this tutorial is not the most important one. In fact you can start learning and using SFML without threads and mutexes. But as the system package is the base for every other package, it is important to know what features it can provide you....
Read More
In this tutorial, we will learn how to use SFML window package as a minimal windowing system, like SDL or GLUT....
Read More
This tutorial is the first one you should read if you're using SFML with the Visual C++ compiler. It will explain how to install SFML, setup your IDE, and compile a SFML program.
Compiling SFML libraries is also explained, for more advanced users (although it's quite simple).
SFML is maintained using VC++ 2005 Professional, but the following ex...
Read More
This is a code snippet of how to normalize a vector in Lua.
function math.vector_length(vector)
return sqrt(vector.x * vector.x + vector * vector.y)
end
function math.vector_normalize(vector)
local length = math.vector_length(vector)
local new_vec = vector
if length > 0 then
new_vec.x, new_vec.y = new_vec.x / length, new_vec....
Read More
function table.is_empty(t)
for _ in pairs(t) do
return false
end
return true
end
...
Read More
function table.is_identical(t1, t2)
if #t1 ~= #t2 then
return false
end
for idx = 1, #t1, 1 do
if t1[idx] ~= t2[idx] then
return false
end
end
return true
end
...
Read More