Viewing 1 to 10 of 946 items

SFML Tutorial - Audio Streams

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
0

SFML Tutorial - Playing a music

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
0

SFML Tutorial - Playing sound

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
0

SFML Tutorial - Generating Random Numbers

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
0

SFML Tutorial - Multithreading

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
0

SFML Tutorial - Setting up SFML in Visual Studio

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
0

Lua Tutorial - Normalize Vector

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         			
               
               
                
                
0