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 - Celtic Minstrel

Pages: 1 [2] 3 4 ... 6
General / Re: How to make a button in SFML?
« on: November 18, 2013, 10:32:07 pm »
Well, for starters, event.MouseButtonReleased is not a thing, though technically it does exist. MouseButtonReleased is in fact a static constant in sf::Event, much like sf::Event::Closed, which tells you that this event was a mouseup event. So you should be checking it event.type == sf::Event::MouseButtonReleased and then check if event.mouseButton.button == sf::Mouse::Right.

As for the error you listed at the bottom, I can't help you with it because I can't figure out where in your code it's being caused.

By the way, instead of BOX you can use sf::IntRect.

System / Re: Problems with making my own InputStream
« on: November 18, 2013, 04:39:11 pm »
Of course not everyone knows everything etc. 7zip users can just right click it.
So 7zip users can right-click (for example) a .uqm file and unpack it? (This is a real file extension, used by The Ur-Quan Masters aka Star Control 2.)

General discussions / Re: Favorite IDE
« on: November 18, 2013, 04:26:44 pm »
I usually use XCode 4 for C++ projects, Eclipse for Java projects, and a text editor (specifically TextWrangler) for everything else. I'd say my favourite is definitely XCode.

I used Visual Studio back in ... 2004/5 or so? I think it might've been VS7, not sure. I'd say it was pretty good  then; I've no idea what it's like now. I'd probably go with Code::Blocks when developing on Windows though, mainly because it's free. I tried it on Mac once, but it was literally unstable (kept crashing), so I'm not actually sure what it's like in practice.

General / Re: Mac Xcode 3
« on: November 18, 2013, 04:08:58 pm »
    Note, I have XCode 4, so it's possible these instructions may be a bit different on Xcode 5.

    Anyway, the reason you're getting linker errors is (probably) because there are two versions of the standard C++ library available on MacOSX. The official distributions of SFML are linked against the GNU standard library, but the default is for projects to link against the LLVM standard library. (I think those descriptors are correct.)

    In XCode 4, this can be changed with the following steps:
    • On your left sidebar (show it if necessary), go to the file browser and click on your project file.
    • In the resulting settings screen, click your project.
    • Type "library" into the search field.
    • Under the "C++ Standard Library" setting, choose "libstdc++" instead of "libc++".
    You might need to adapt these instructions a little for XCode 5. (Perhaps ironically, if you were using XCode 3 this issue wouldn't even exist. :P )

    The other alternative (which is what I did) is to download the SFML source and build it yourself against libc++. I won't go into detail on how to do this, but basically you just need to add "-stdlib=libc++" as a linker argument in CMake. The advantage of this is that libc++ has C++11 support, whereas libstdc++ does not. (For example, it has the regex library, the new shared_ptr, and many other things.)

System / Re: Problems with making my own InputStream
« on: November 18, 2013, 03:56:52 pm »
You essentially could to both, it's just that by now zip is something most users are familiar with and it's as easy as to right click on the file and chose "unpack archive",
But this only works if the file extension is ".zip". Change your zip file's extension to something random, and most people won't even realize it's a zip file.

System / Re: cout operator << doesn't work for getElapsedTime ()
« on: November 18, 2013, 03:48:20 pm »
And if people do want an operator<< they can actually define it themselves.

System / Re: cout operator << doesn't work for getElapsedTime ()
« on: November 16, 2013, 09:15:30 pm »
because very rarely is one going to use an << for production code.
I would disagree on this. There's one very good reason why you might want to use << for production code — saving data to disk. Of course, this does assume you've decided on a plaintext file format, but there's nothing inherently wrong with that.

System / Re: cout operator << doesn't work for getElapsedTime ()
« on: November 16, 2013, 02:04:25 am »
For exactly this case where you just want to output the time and don't particularly care about the format... it could even print the units for you.

Of course, someone wanting that could just define it in their own program, so it's not really something important.

System / Re: Incorrect key mapping? (OSX)
« on: November 16, 2013, 01:54:10 am »
Oh yeah, I forgot numpad equals and decimal are indistinguishable from their non-numpad counterparts... this is still the case as well.

But most of that is about missing keys, not downright incorrect keys. Still, I guess I'll repost this on that thread, then.

EDIT: Looks like someone already reported the hyphen issue. Ah well.

System / Re: cout operator << doesn't work for getElapsedTime ()
« on: November 16, 2013, 01:23:09 am »
Wouldn't hurt to define an operator<< for sf::Time, though...

System / Incorrect key mapping? (OSX)
« on: November 16, 2013, 12:44:15 am »
I just noticed that when I press the (-/_) key (between 0 and +/=) on my Apple keyboard, it's reported by keypress events as Keyboard::Menu instead of Keyboard::Dash. I'm on MacOSX (10.7), and I compiled the libraries myself using CMake. Does this happen for anyone else?

EDIT: More detail! The key event says it's KEY_MENU and in addition that it has all four modifier keys pressed, when in fact none were pressed; also, no TextEntered event seems to be generated. Pressing it with a modifier key seems not to trigger any keypress event, though with shift or option a TextEntered event is generated.

EDIT 2: On closer inspection, it looks like there's no KeyPressed event at all and the event is simply a TextEntered event. So, the TextEntered is generated, but the KeyPressed is not. This is contrary to the behaviour of (for example) alphabetic keys, which generate both a KeyPress and a TextEntered.

EDIT 3: This prompted me to try all keys to see what they're reported as, and I discovered that pressing tilde generates Keyboard::Dash instead of Keyboard::Tilde! However, if a modifier key is held while pressing tilde, no keypress seems to be reported. There were other things as well that I noticed, but they're probably not as important.

EDIT 4: Not quite related, but I can't catch Command-Period. When I press it I just hear the system alert sound and my program doesn't get an event. This could be related to Command-Period being a common "interrupt" sequence? I'm not sure.

General / Re: opinions: how to handle resource errors?
« on: November 10, 2013, 07:34:10 pm »
I was going to mention that writing to a log file is always an available option, but then I saw that Ixrec explained why that's not a great option.

It's not all that hard to open the log-file, but doing so in a platform-agnostic way is probably impossible (unless you're not supporting Linux). The basic idea would be executing a command (as system() does, though that's not the way I'd recommend doing it). On Windows it would be "notepad errorlog.txt", on Mac you'd run "open -a TextEdit errorlog.txt" (though this isn't working when I try it for some reason), and on Linux... well, I doubt you can assume any specific text editor is installed, unfortunately.

The proper way to execute a command is the exec* family of functions on Mac and Linux (execlp is probably the simplest choice in this situation). On Windows I think there's an equivalent (maybe something like ExecuteProcess?), but I'm not sure what it is.

If you prefer actual popup dialogs, the equivalent of MessageBox on Mac appears to be CFUserNotification, though it looks rather more complicated. On Linux, perhaps Zenity would work (in which case you'd probably call it with execlp); I'm not sure if there's a system call that makes a popup dialog.

Keep in mind that using the .NET Framework will limit you to machines that have the .NET Framework installed. This means something like Windows only, if you limit yourself to .NET Compact Framework 2.0 you may get your app to run on a Xbox.
While I agree with the sentiment, it's not true that .NET is limited to Windows. Mono is a cross-platform .NET implementation which works on Mac and Linux (although I think it doesn't implement a few older, deprecated interfaces).

General / Re: Get Key Name
« on: July 07, 2012, 04:57:11 am »
Try double-braces:
const static std::array <std::string, sf::Keyboard::Key::KeyCount - 1>  nombreTeclas = {{ /* stuff here */ }};

The reason for this is because std::array<T, n> is equivalent to this:
struct array {
    T values[n];

That said, in this context I'm pretty sure it's supposed to work without the extra braces, so this may be a compiler bug. If nothing else works, you could always just use a bare array.

General / Re: CMake variable name conventions
« on: July 07, 2012, 04:54:19 am »
It's kinda odd; in English, a plural doesn't really make sense there either, since it's a shortened form of "Build Documentation"; yet, somehow, pluralizing the shortened form ("Build Docs") seems to be a fairly common convention and, to me, doesn't sound odd.

Pages: 1 [2] 3 4 ... 6