61
SFML website / Typo
« on: May 23, 2011, 03:00:37 am »
Well, technically, "si" in spanish means "if"
![Tongue :P](https://www.sfml-dev.org/forums/Smileys/default/tongue.gif)
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.
Quote from: "Mjonir"My project is aimed at both scripters (who really need the console) and their end-users (who don't need/want to see the console). So at the moment I do have multiple build targets, but I'd be force to release two different versions of my program, one with the console and one without. If I could control that in the application itself, I could only give only one build and control that in the configuration file. It's not an absolute need, but it'd be neater if it's easy enough to control.
I'll have a look at Windows.h then. I hope it wouldn't break portability too much to do it this way though :?
It is probably not as easy as you wish. Once you have created a new console-window you have for example to redirect the standard input and output streams to this window.
It is possible and described here, but it is rather complicated.
But I have an easy suggestion for you. Just create a console-application and if you don't want to show the console window, useCode: [Select]
ShowWindow(GetConsoleWindow(), SW_HIDE);
to hide it(Further information).
I think hiding an existing console is easier than creating a new one.
ShowWindow(GetConsoleWindow(), SW_SHOW);
also work?
You don't need code to remove the console window
Project -> Properties -> Build Type -> it SHOULD say Console application, change it to Gui Application.
Make sure to set it to same on Debug AND release (on left) or whichever you prefer
Note: May require you to restart codeblocks, sometimes it does for me.
Hope this helps.
Quote from: "David"
Can you do this? :?Code: [Select]
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Shift)) {
// Do here what you want to happen when the user presses shift
}
You can do it in a very similar way. Key Event has special variables to check, wether shift, control or alt was pressed or not.Code: [Select]
if ((Event.Type == sf::Event::KeyPressed) && Event.Key.Shift )
{
// Do here what you want to happen when the user presses shift
}
So this should work.
Quote from: "David"Your explaination helped
And for the Events part, I just want to know how can you program a key listener so the user can press the SHIFT key and make it do something
There is no need for a key listener (Java programmer?). If you want something to happen when the user presses shift, you can do this (inside the event-loop):Code: [Select]
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::LShift)) {
// Do here what you want to happen when the user presses shift
}
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Shift)) {
// Do here what you want to happen when the user presses shift
}
if ((Event.Type == sf::Event::KeyPressed) && ((Event.Key.Code == sf::Key::LShift) || (Event.Key.Code == sf::Key::RShift)) {
// Do here what you want to happen when the user presses shift
}