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 - didii

Pages: 1 ... 3 4 [5] 6 7 ... 9
61
SFML projects / Re: Thor 2.0
« on: December 02, 2013, 04:05:58 pm »
Should Distribution<T> be convertible to Distribution<U> if T is convertible to U (as it is now)? Or only explicitly? Hm... ???
In my opinion it's always more safe to only use explicit conversions. I like the way current C conversions happen: allow it, but display a (compiler) warning. But I suppose this is impossible without altering the compiler.
Allowing the conversion gives the user a more freedom and less tedious (and in a lot of cases unnecessary) conversions, but this does withhold users who are newer to C++ to learn that there is an actual difference between writing 90, 90. and 90.f. So it's your target audience or the reason behind the creation of Thor that matters I suppose.

62
Graphics / Re: File extension for best performance
« on: December 02, 2013, 03:52:48 pm »
Yup, I was wrong again... Thanks for correcting me, I think I'll never stop learning new stuff in C++ :)

63
Graphics / Re: File extension for best performance
« on: November 28, 2013, 02:51:27 pm »
Sending textures to the GPU will always be the same no matter what format you use. Reason is because once an image is loaded it uses the same RGBA format to be loaded on the GPU.
Aren't you contradicting yourself?
Sending textures to the GPU = when they are being loaded
once an image is loaded = when it has finished loading

What you should instead test is the loading of each format into a sf::Image. And do it more than 20 times, 20 times is no where close enough times to be accurate.
I included the code specifically for people who were not satisfied with my results ;) Feel free to use/adapt it.
Read the tutorial about Sprites and textures for the difference between a sf::Texture and an sf::Image. Since the OP talks about loading textures I assumed it was about loading an image file onto the GPU thus I used sf::Texture.

64
SFML projects / Re: Thor 2.0
« on: November 28, 2013, 11:58:15 am »
It does not accept it, otherwise there would be no error. With templates, there are mostly multiple error messages, each referring to a separate layer in the problematic call. If you scroll down, you will find the error in user code.
Indeed, in the 14th layer I can indeed see the referral to the main function :D So the actual 'problem' lies in the usage of different templates? Then probably Intellisense is also not made to look in such a depth. Thanks for clearing that up.

The return type is clear for a given function in the thor::Distributions namespace and for given argument types. In C++, a function cannot just return "anything", there's always a type.
Like I said in my second post. Disregard my first one, didn't see a lot of things. You indeed restrict its return type, but I thought, if you simply use
template <class C> void myFunc(C functor);
You are asking for any functor with any return type right? It just seems so unlikely for C++ to do such a thing. But if I now look at it, it's a template so you are in fact explicitly allowing it...

I don't hope, I expect him to use it correctly... For some reason there is the documentation ;)
Again, disregard my first post :)

65
Graphics / Re: File extension for best performance
« on: November 28, 2013, 03:41:04 am »
If you're talking about loading time, I have no idea if there is a significant difference. You can try and tell us. :p
A GPU needs some warm-up time, the very first texture loaded onto the GPU will almost always take longer than any following textures to load. That being said, I tested it with a 4000x4000 plain white image of all 3 supported file types. Each loaded up 20x times in a row and took the avarage time. I've warmed up the GPU by loading the image 3 times in a row. The results:
Code: [Select]
PNG time: 999.297ms
JPG time: 995.337ms
BMP time: 988.297ms

This is of course in the notion that a GPU has no memory and indeed loads the image again completely. I did not find an SFML-function to remove a texture from the GPU so I assumed that it got deleted automatically when the sf::Texture is destroyed. Also The results all seem to change every time I run it by about 10ms no matter how many tests I run. I assume it's due to the randomness of my GPU or due to the accuracy of <chrono>.

Here is the code I used. Feel free to test it on your own GPU.

66
SFML projects / Re: Thor 2.0
« on: November 28, 2013, 01:47:26 am »
Now I feel embarrassed... So much mistakes were made from my side. I should now have found the problem, so let me rephrase everything.

When I give thor::UniversalEmitter::setParticleVelocity as input argument a thor::Distributions::uniform, the compiler accepts the argument and shows an error in xrefwrap instead. Below is a minimal working example. I have absolutely no idea why the compiler accepts a wrong input parameter. And I cannot seem to replicate it. I have already tried creating a uniform class/struct that inherits from Distribution<float>, getting the exact same error.

#include <Thor/Particles/Emitters.hpp>
#include <Thor/Math/Distributions.hpp>

int main() {
        thor::UniversalEmitter emitter;
        emitter.setParticleVelocity(thor::Distributions::uniform(-100.f,100.f));

        return 0;
}

67
SFML projects / Re: Thor 2.0
« on: November 27, 2013, 10:31:25 pm »
If I would write the following
thor::UniversalEmitter emitter;
emitter.setParticleVelocity(thor::Distributions::uniform(-100.f,100.f));
for which the syntax is correct but will give an error wrong since thor::UniversalEmitter::setParticleVelocity needs a sf::Vector2<float> and thor::Distributions::uniform will return a float. When building, I get an error referring to
Code: [Select]
xrefwrap(431): error C2664: 'sf::Vector2<T>::Vector2(const sf::Vector2<T> &)' : cannot convert parameter 1 from 'float' to 'const sf::Vector2<T> &'which is quite confusing since you have no idea where the error comes from if you are not familiar with functors and/or Thor. Is there a possibility to separate the distributions according to their return type? Or is this error common while using functors?

I do have to note that I'm not familiar with functors and have no idea if it is possible at all. Also, I'm sorry if this has already been mentioned, I only did a very quick search on these 17 pages..



EDIT: I'm sorry, should have read 1 page more about functors before commenting here. So it does not seem possible to do this for which the compiler can notice the mistake from where it actually happens. It does seem to be possible to do this with functions though, but I can see the downsides of that.
Defining an abstract base template class won't work either since you are again stuck with the number of arguments... Is it really impossible to restrict the return types on functors? It seems so unlikely that you would accept and use a function without ever knowing which type it will return. Hoping that the user will use it correct is generally a bad practice...

EDIT2: oh, I used the most recent version of Thor btw right from your GitHub.

68
I've should have done something wrong with cmake. After downloading the pre-compiled version of SFML 2.1 and overwriting the libs, includes and .dll's the error is gone.

Quick question though: which of these files needs those visual studio specific files? The libraries or the .dll's?

69
General / Re: Setting up
« on: November 02, 2013, 12:20:00 pm »
Just build your project, then an .exe should be made somewhere in your working directory. The exact location is depended on the program you're using. Be sure to include your .dll's if you don't link your project statically.

70
I've just gone from MSVC2010 to MSVC2012, loaded my old project up and had a lot of errors. Managed to get them away by simply creating a new one and copying all .cpp and .h files into it. I've also recompiled SFML for MSVC11 and linked my project with those files.

The problem I now have is that when I want to start my application it asks for the msvcr100d.dll file which is still from MSVC2010. Does that mean that I have not correctly compiled SFML and that SFML still needs that .dll or something entirely different? I don't get any error when I don't link SFML or don't use anything of it.
Downloading the msvcr100d.dll does not seem like the correct solution... I have found the msvcr110d.dll in the install folder.

Sorry to be bothering you by this.

71
SFML projects / Re: MineSweeper
« on: June 12, 2013, 12:28:27 pm »
Quote
Take this as a warning to be careful when copying stuff over the internet. Everything you find on the internet is automatically licensed except when explicitly said it is not (which is fundamentally wrong in my opinion) as Silvah said. When working on a bigger project this is pretty important to keep in mind.
Yeah, I'm definitely going to remember this for future projects. Maybe I should try to make my own sprites/sounds etc., the problem is I suck at that.
With the current system of licencing you don't have a lot of choice. There are plenty of sites though who wants to share their art, tilesets and/or sounds. Deviantart is a great place to get some inspiration, but has a lot of licensed stuff. Or search for 'tileset' on Google and you'll find plenty of sites with graphics free to use.

Everything you find on the internet is automatically licensed except when explicitly said it is not
There's another problem with that: in most jurisdictions (the US being a notable exception), it's actually impossible to say "this work of mine is not copyrighted". Such statement has no legal effect in these jurisdictions.
Then the system is even worse than I thought... Good to know though. But that means the only way of sharing the things you've made is to ask for such a zlib/libpng licence as SFML has?

72
SFML projects / Re: MineSweeper
« on: June 12, 2013, 02:23:37 am »
It's almost impossible to find it using Google without knowing my name. The graphics itself are only found inside a .zip-file on my Github, so impossible to find using Google Images.


It's not that I mind that much, I was mostly surprised by seeing this, not harmed. And actually on reflecting, I'm glad my project has helped you further completing yours. Use it as you like, that'll help you more than myself, since I stopped working on it. And in fact, I remember creating the topic specifically to help people who are thinking about making the same. So I'm kind of being a hypocrite right now, but it was on purpose.

Take this as a warning to be careful when copying stuff over the internet. Everything you find on the internet is automatically licensed except when explicitly said it is not (which is fundamentally wrong in my opinion) as Silvah said. When working on a bigger project this is pretty important to keep in mind.

So use it as you like. I'm glad I was able to help you :)


Wow, thanks for stealing my stuff...
Hmm. By investigating his code there doesn't seem to be many similarities at all. He might have taken inspiration from your code and application, but the only thing I can see he have stolen from you is the graphics, how is the graphics licensed? Did you create them yourself?
I did not inspect the code, since I did not have the time to do it. That's why I wrote 'stuff' :P and yes I've created them myself with Paint!

73
SFML projects / Re: MineSweeper
« on: June 11, 2013, 01:25:56 pm »
Wow, thanks for stealing my stuff...

74
SFML projects / Re: Tetris + AI
« on: February 26, 2013, 09:06:00 am »
Very cool. I'm surprised though that he cannot go on forever. I suspect that this is because he doesn't plan ahead and does not know when he actually loses, or should the adaptable AI solve this?

75
SFML projects / Minesweeper
« on: February 21, 2013, 03:37:26 am »
Hi there!

Been a pretty long time (~4 months) since I've been here. Stopped programming for a while, but I picked it up again a week or 2 ago or so and I decided to make a minesweeper to get familiar with working with tiles since I had an idea of a turn/tile-based game.

Mind that this is my first program in SFML apart from Pong :D
It's still pretty basic and I'm planning to add extra stuff such as rectangular tiles, and various other modes. But first of I'd like to improve the menu and the look of the game (adding borders and such).




If you want to play the game here is some useful info:
In the main menu:
... read the instructions shown on screen.
... you can also start the game using 'F8'. This will start the game in a debug mode instead of the normal mode. This will give some useful info on the output prompt and is recommended if you want to have an insight on how I implemented it before looking at my poorly commented code ::)
While playing:
... pressing 'h' will show a hint. It will highlight random tile that is not a bomb and prioritizes empty tiles. Use this only when you have to guess. I implemented this because I hate guessing in minesweeper 8)
... do not minimize the prompt. It will tell you how many bombs are left and will wish you good luck ;)
... pressing 'Escape' immediately takes you back to the main menu.



Here is my github. The executable is packed in Release.zip. Just press 'View Raw' to download. If you want to have a look at the code please do and write all your findings here ;)

Screenshots:




Pages: 1 ... 3 4 [5] 6 7 ... 9
anything