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.


Messages - pighead10

Pages: 1 2 [3] 4
31
SFML projects / Re: TGUI: a c++ GUI for SFML (with Form Builder)
« on: July 15, 2012, 03:10:33 pm »
Yes, on the version I was using (the one with the View crashes) whenever I pressed 'load' it would just stop responding and windows would close it. It's fixed in the latest version, so now I finally have a working GUI for my game! :D

I've found what I think is an issue with hide(), though. I am running this code:

void TguiWidget::hide(){
        for(std::map<std::string,std::shared_ptr<tgui::OBJECT>>::iterator it = objects.begin();it!=objects.end();it++){
                it->second->hide();
        }
        displayed = false;
}

`objects` contains a Button, Label and Button, 'wood_icon', 'money_icon', and 'shop_exit' respectively. 'money_icon' and 'shop_exit' are hidden fine, but 'wood_icon' stays on the screen. Its events get disabled - hovering over it doesn't change anything and it doesn't register any clicks even though the callbackID is not 0 - but you can still see it.

I used the form builder for this. I've attached the form.txt.


[attachment deleted by admin]

32
SFML projects / Re: TGUI: a c++ GUI for SFML (with Form Builder)
« on: July 15, 2012, 01:45:06 pm »
Also, the form builder crashes whenever I try and load.
EDIT: On the newest version it doesn't.

33
SFML projects / Re: TGUI: a c++ GUI for SFML (with Form Builder)
« on: July 15, 2012, 01:24:05 pm »
Is the fixed version available for download?

34
SFML projects / Re: TGUI: a c++ GUI for SFML (with Form Builder)
« on: July 14, 2012, 06:04:02 pm »
I've found a fairly severe bug with tgui (unless I'm doing something wrong). I created a window which is 800x600, and a button which is 600x600, but I have also used a sf::View. The view is created in a larger rectangle so that anything originally 200x200 looks 25x25. This works correctly with the button - the 600x600 button does not take up much of the screen - but the area in which I can click it does not adjust. If I click on the button, it doesn't work, but if I click anywhere where a 600x600 button would be without a sf::View, the button clicks.

35
I tried limiting the FPS to 60, and everything that was related to frame time slowed down hugely. I'm assuming I have screwed it up somehow and it is not SFML's fault...  :'(

36
200 FPS is still a lot.

What's your OS?

Don't forget that setFramerateLimit uses sf::sleep internally, and that the resolution of the latter might not be low enough for 200 FPS, depending on your OS.

I have windows 7. I'm not sure what you mean by your second sentence, though.

37
After upgrading (I decided to after it still wasn't working), this is my code:

Code: [Select]
void AppStateManager::start(AppState* state){
changeAppState(state);
double frameTime = 1;
int startTime = 0;
SfmlFramework::Singleton()->window->setFramerateLimit(200);
while(!m_bShutdown){
sf::Clock clock;
if(!SfmlFramework::Singleton()->window->isOpen())m_bShutdown = true;
SfmlFramework::Singleton()->window->clear();


//capture input and handle application-wide events
sf::Event evt;
while(SfmlFramework::Singleton()->window->pollEvent(evt)){
switch(evt.type){
case sf::Event::KeyPressed:
m_ActiveStateStack.back()->keyPressed(evt.key.code);
break;
case sf::Event::KeyReleased:
m_ActiveStateStack.back()->keyReleased(evt.key.code);
break;
case sf::Event::MouseMoved:
m_ActiveStateStack.back()->mouseMoved(sf::Vector2f(evt.mouseMove.x,evt.mouseMove.y));
break;
case sf::Event::MouseButtonPressed:
m_ActiveStateStack.back()->mousePressed(evt.mouseButton.button);
break;
case sf::Event::MouseButtonReleased:
m_ActiveStateStack.back()->mouseReleased(evt.mouseButton.button);
break;
case sf::Event::Closed:
m_bShutdown = true;
break;
default:
break;
}
}
if(!m_bShutdown)
m_ActiveStateStack.back()->update(frameTime);

frameTime = clock.restart().asMilliseconds();
std::cout << frameTime << std::endl;

SfmlFramework::Singleton()->window->display();
}

SfmlFramework::Singleton()->window->close();

}

In release, it runs at 240 fps and prints 1 a lot. However, when standalone, it runs at the same fps and prints "0" over and over and the occasional "4". Have I done somethnig to cause this?... (presumably this is the same problem as before, so on some computers it would work standalone). Also, the rest of the program that is based on frameTime like movement is running slower even in release mode.

38
That hadn't occurred to me - I've never made anything that runs at more than 200 fps before, except this game has 2 bit graphics >.>

Thank you

39
Would that mean I have to change a lot of my code? The documentation has differences like capitalization and I have a decent amount of code in this project. Is this a known bug?

40
I'm using SFML 2.0, but NOT the newest version of it. GetFrameTime() exists and GetElapsedTime() returns an sf::Uint32.

Here is the code:

Code: [Select]
void AppStateManager::start(AppState* state){
changeAppState(state);
double frameTime = 1;
int startTime = 0;
while(!m_bShutdown){
sf::Clock clock;
if(!SfmlFramework::Singleton()->window->IsOpened())m_bShutdown = true;
SfmlFramework::Singleton()->window->Clear();


//capture input and handle application-wide events
sf::Event evt;
while(SfmlFramework::Singleton()->window->PollEvent(evt)){
switch(evt.Type){
case sf::Event::KeyPressed:
m_ActiveStateStack.back()->keyPressed(evt.Key.Code);
break;
case sf::Event::KeyReleased:
m_ActiveStateStack.back()->keyReleased(evt.Key.Code);
break;
case sf::Event::MouseMoved:
m_ActiveStateStack.back()->mouseMoved(sf::Vector2f(evt.MouseMove.X,evt.MouseMove.Y));
break;
case sf::Event::MouseButtonPressed:
m_ActiveStateStack.back()->mousePressed(evt.MouseButton.Button);
break;
case sf::Event::MouseButtonReleased:
m_ActiveStateStack.back()->mouseReleased(evt.MouseButton.Button);
break;
case sf::Event::Closed:
m_bShutdown = true;
break;
default:
break;
}
}
if(!m_bShutdown)
m_ActiveStateStack.back()->update(frameTime);

frameTime = clock.GetElapsedTime();
clock.Reset();
std::cout << frameTime << std::endl;

SfmlFramework::Singleton()->window->Display();
}

SfmlFramework::Singleton()->window->Close();

}

When run in visual c++ 2010, it outputs correctly - 2 2 2 2 2 2 2 2 2. When run on SOME computers standalone, it also runs correctly. However, on some other computers - mine included - when run standalone it outputs 0 for a while then outputs something close to 15. This is obviously causing a massive problem with my game as a lot of people are experiencing an issue where the movement is incorrect.

How can I fix this?

41
General / SFML 2.0 randomiser?
« on: January 28, 2012, 04:07:05 pm »
I can't find it in the documentation, is it removed?

42
Window / frameTime is always 0
« on: January 18, 2012, 05:04:11 pm »
The frametime is always 0 and I cannot understand why.

I am using sfml 2.0.

Code: [Select]
while(!m_bShutdown){
if(!SfmlFramework::Singleton()->window->IsOpened())m_bShutdown = true;



//capture input and handle application-wide events
sf::Event evt;
while(SfmlFramework::Singleton()->window->PollEvent(evt)){
switch(evt.Type){
case sf::Event::KeyPressed:
m_ActiveStateStack.back()->keyPressed(evt.Key.Code);
break;
case sf::Event::KeyReleased:
m_ActiveStateStack.back()->keyReleased(evt.Key.Code);
break;
case sf::Event::MouseMoved:
m_ActiveStateStack.back()->mouseMoved(sf::Vector2f(evt.MouseMove.X,evt.MouseMove.Y));
break;
case sf::Event::MouseButtonPressed:
m_ActiveStateStack.back()->mousePressed(evt.MouseButton.Button);
break;
case sf::Event::MouseButtonReleased:
m_ActiveStateStack.back()->mouseReleased(evt.MouseButton.Button);
break;
case sf::Event::Closed:
m_bShutdown = true;
break;
default:
break;
}
}
std::cout << "AppStateManager update " << frameTime << std::endl;
m_ActiveStateStack.back()->update(frameTime);

frameTime = SfmlFramework::Singleton()->window->GetFrameTime();
}

43
General / Mini-framework AppState rendering problem
« on: January 09, 2012, 08:07:53 pm »
I made a mini framework for sfml, based off a framework for a 3d rendering engine I have used. It uses "AppStates", which the program is constantly in one - for example, MenuState, GameState. These render a screen whenever one is entered.

In the rendering engine I used this came from, there were SceneManagers to organize the scenes and hold the data rendered in that SceneManager, including a camera which the 'viewport' would be set to. I am new to sfml and not familiar with the various features - is there anything like a SceneManager I could use to achieve the same affect, or would I have to create my own? (I'm assuming 'views' in SFML can be used to the same affect as the viewports - I haven't looked through that part much, please correct me if I am wrong).

Thanks in advance!

44
General / SFML 2.0 PostFX?
« on: December 30, 2011, 02:43:00 pm »
Oh, I didn't see that :D

My compiler says sf::Shader::setTexture is a functiom, but I can't see it in the documentation?

45
General / SFML 2.0 PostFX?
« on: December 29, 2011, 10:18:59 pm »
I am following the 1.6 tutorials using the 2.0 version of SFML, and I'm trying to use shaders. Instead of sf::PostFX which isn't there, I thought sf::Shader is the equivalent. Furthermore, I tried using the sf::Shader::SetTexture, which not only does not accept 'NULL' as its second argument so I don't know how to tell it to use the contents of the screen but half the functions in sf::Shader that are listed by visual studio don't seem to be in the documentation. sf::Shader::SetTexture isn't.

How can use the equivalent of postfx in 2.0?

Pages: 1 2 [3] 4
anything