Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

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.


Topics - Contadotempo

Pages: 1 [2]
16
General / [Solved]Draw FPS each second
« on: October 31, 2010, 06:07:02 pm »
Hi,
I'm trying to make a function that would draw how many FPS were displayed each second.
The original function is:

Code: [Select]
double app_properties::draw_fps()
{
stringstream ss;
getfps=1/(App.GetFrameTime()); //getfps is a float declared in the app_properties class
ss << getfps;
dfps.SetText("FPS: " + (ss.str()).substr(0,2)); //dfps is a font string declared in the app_properties class
App.Draw(dfps);
return getfps;
}


How could I change this and make it draw the FPS only each second?
This is probably very easy to do, but I'm being dumb...

Thanks in advance!

17
General / [Solved]Problem Setting up Code::Blocks
« on: October 16, 2010, 01:55:22 am »
Yet again another thread of a problem I couldn't solve for myself... Hope I'm not getting annoying.

I tried to set up SFML on Code::Blocks, following the documentation on the tutorial section but I'm not being very successful.

I think I did everything right, but when I try to compile a simple code using static libraries (I.E. -lsfml-system-s), I get the following:


However, when I use -lsfml-system, it compiles just fine.
What could be wrong?

Thanks in advance

18
General / Capture Enter Key
« on: October 15, 2010, 03:27:21 pm »
Hi, I believe this is very simple to do but I'm probably being thick.

How can I capture the enter key, in order to confirm a selection.
I tried App.GetInput().IsKeyDown(Key::Enter) but I that's not correct since Key doesn't have the "Enter" option.

Thanks in advance.

19
General / Thread Priority
« on: October 04, 2010, 01:17:58 am »
Hello, once again.
Sorry for creating so many threads in a short amount of time but since I'm on a learning phase, I really want  to solve my questions.

Is there a way to change the priority of a thread?
I noticed all the threads I create are being executed with "Lowest" priority.


On the image, the worker thread plays a music, but since it's running on lowest priority, whenever I do something outside of the application (Open browser, open a folder, open a winrar archive, etc...) the music starts slowing down and skipping.

Is there a way to change this? Or should I stop using SFML thread classes?
Thanks in advance.

20
General / Pass data to a thread function
« on: October 02, 2010, 04:19:34 am »
Hi, I have a simple question about passing a variable to a thread function that I think it's easy to answer.

I was following this tutorial:
http://www.sfml-dev.org/tutorials/1.6/system-threads.php
And I read the part that explains my question, however I'm not having success when I try to pass a variable to the thread function.


I have the variable int n declared on the main, where n's value is 5.
Now I want to pass this value to a threaded function.
I tried the following:

Code: [Select]

void print_Console(void *UserData)
{
int* n = static_cast<int*>(UserData);
cout << "n=" << *n << endl;
}

int main()
{
int n=2; //EDITED AT Sat Oct 02, 2010 11:50 am
Thread th1(&print_Console, &n);
th1.Launch();
}



But it's not outputting n correctly.
So, what could be wrong here?

Thanks in advance

21
Audio / Failed to load sound buffer from file
« on: September 29, 2010, 08:26:38 pm »
Hi, I'm new to the forums so I'm not sure if I'm posting in the correct section, but here it goes.

I tried making a program in Visual Studio C++ 2008 using SFML, that would play a simple .wav file. However when I run it I only get the message:
"Failed to load sound buffer from file "sound.wav".

The code is the default one provided on the Audio tutorial:
http://www.sfml-dev.org/tutorials/1.6/audio-sound.php

source file in: http://www.sfml-dev.org/tutorials/1.6/sources/audio-sound.cpp

I've included libsndfile-1 and openal32 on the exe folder. The sound is present on the folder as well and is named sound.wav

What could be wrong?

Thanks in advance for any help

Pages: 1 [2]