31
General discussions / Filesystem from SFML?
« on: July 01, 2011, 12:01:15 am »
Thank you for the link. Interesting. I should make better use of the search function.
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.
sf::String s;
s='a';
the character 'a' has a representation and a meaning. The representation is the binary code, a number in essence. The meaning is the letter a. For example, char x = 97;
(x == 'a')
evaluates to true.#include <cstdlib>
#include <SFML/System.hpp>
int main()
{
sf::Clock Clock;
sf::String s;
char buffer[10];
Uint32 time;
time=Clock.GetElapsedTime();
while(time<5000)
{
int hours = time/3600000; // We get the number of hours, there's 3600000 milliseconds in each hour
time -= hours * 3600000; // Now that we know the number of hours, we remove that number of milliseconds from time so we can figure out the minutes left over.
itoa(hours, buffer, 10);
s=buffer; // I took a quick look at String's documentation, I think this is valid.
// You might have to do a bit more magic to get the chars into the string, but at least buffer now has the right values
s+=" hours, "; //s only contained a number (written in characters), now it contains the string "hh hours, " where hh means the number of hours
int minutes = time / 60000 ; // There's 60000ms in each minute
time -= minutes * 60000;
itoa(minutes, buffer, 10);
s+=buffer; s+=" minutes, ";
int seconds = time / 1000; // Naturally, there are 1000ms per second
time -= seconds * 1000;
itoa(seconds, buffer, 10);
s+=buffer; s+=".";
itoa(time, buffer, 10);
s+=buffer; s+=" seconds.\n";
// Right now, s contains a string that looks like "hh hours, mm minutes, ss.mmm seconds."
// You can now attempt to display the string in whatever manner best suits your needs.
time=Clock.GetElapsedTime();
} // The loop will run for 5 seconds before exiting.
return 0;
}
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL);
would be in SFML.
An optional style can be passed to customize the look and behaviour of the window (borders, title bar, resizable, closable, ...). If style contains Style::Fullscreen, then mode must be a valid video mode.
$ mingw32-make install
Scanning dependencies of target sfml-system
[ 1%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Clock.cpp.obj
[ 2%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Err.cpp.obj
[ 3%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Lock.cpp.obj
[ 5%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Mutex.cpp.obj
[ 6%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Sleep.cpp.obj
[ 7%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/String.cpp.obj
[ 8%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Thread.cpp.obj
[ 10%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/ThreadLocal.cpp.obj
[ 11%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Win32/MutexImpl.cpp.obj
[ 12%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Win32/Platform.cpp.obj
[ 14%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Win32/ThreadImpl.cpp.obj
D:\libs\SFML\src\SFML\System\Win32\ThreadImpl.cpp: In member function 'void sf::priv::ThreadImpl::Wait()':
D:\libs\SFML\src\SFML\System\Win32\ThreadImpl.cpp:63:33: error: 'GetThreadId' was not declared in this scope
mingw32-make[2]: *** [src/SFML/System/CMakeFiles/sfml-system.dir/Win32/ThreadImpl.cpp.obj] Error 1
mingw32-make[1]: *** [src/SFML/System/CMakeFiles/sfml-system.dir/all] Error 2
mingw32-make: *** [all] Error 2