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

Author Topic: SFML 2.0 RC  (Read 127237 times)

0 Members and 7 Guests are viewing this topic.

cekota

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: SFML 2.0 RC
« Reply #210 on: October 07, 2012, 11:30:57 pm »
In the SFML API, there are a lot of function that have default parameters.

Sometimes these default parameter are easy to find from the headers.
Sometimes there are several definitions of the same function so that tracking the default parameter has to be made by reading the source code of SFML, not the header anymore.

When wrapping CSFML this is quite a pain.

More over hard I don't like coding the default parameters in the wrapper because, maybe one day the default value would change, maybe in SFML 3.X.

It would be nice to provide some facilities to get these default parameters.

There could be several ways to do so, one simple possibility could be defining some variable, for example:


<Value_Type> <Function_Name>_<Param_Nane>_Default = <Default_Value>

sfTextureCoordinateType  sfTexture_bind_texture_default = sfTexCoordType_Normalized;

#define MAKE_DEFAULT_PARAM( func_name, param_name, param_type, default_value) \
  param_type func_name##_##param_name##_default = default_value;


MAKE_DEFAULT_PARAM( sfTexture_bind, coordType, sfTextureCoordinateType, sfTexCoordType_Normalized )

 

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 RC
« Reply #211 on: October 08, 2012, 07:53:43 am »
Quote
The problem is that I really don't see what I can do with a const sfTransform_Identity. If I want to use it I will copy it and then use some rotate and translate functions on the copy. So in this case I was thinking that sfTransform_getIdentity() would makes sens.
If CSFML does the copy, then every user in every situation will be forced to do this copy. If I directly provide the object, then it's up to the user to decide if he wants to make a copy of it or not. There are many situations where you won't need to copy it, for example when you want to pass an identity matrix to a function that has a sfTransform argument.
So there's no problem, just more flexibility.

Quote
The parameter "coordinateType" is missing.
https://github.com/SFML/CSFML/issues/9#issuecomment-6586469
Laurent Gomila - SFML developer

cekota

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: SFML 2.0 RC
« Reply #212 on: October 08, 2012, 05:04:51 pm »
If CSFML does the copy, then every user in every situation will be forced to do this copy. If I directly provide the object, then it's up to the user to decide if he wants to make a copy of it or not. There are many situations where you won't need to copy it, for example when you want to pass an identity matrix to a function that has a sfTransform argument.
So there's no problem, just more flexibility.

Oh, I see.
Thank you very much for taking time to instruct me :)

Quote
The parameter "coordinateType" is missing.
https://github.com/SFML/CSFML/issues/9#issuecomment-6586469

Oh, I see.
Then I'll remove it from my bindings.

cekota

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: SFML 2.0 RC
« Reply #213 on: October 08, 2012, 05:10:45 pm »
And what about providing the default parameters in an accessible way?

(as asked in my previous post)

While writing my binding, I've read sources of other SFML bindings. From comments, or svn commit messages (don't remember which) I have seen that this is not only a problem for me, but also for other binders.
« Last Edit: October 08, 2012, 05:38:09 pm by cekota »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 RC
« Reply #214 on: October 08, 2012, 08:03:15 pm »
Quote
And what about providing the default parameters in an accessible way?
Which parameters in which functions are not "accessible"? They are all explicitely documented. I think using macros would be quite ugly and make things even worse.
Laurent Gomila - SFML developer

cekota

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: SFML 2.0 RC
« Reply #215 on: October 08, 2012, 08:54:51 pm »
They are all accessible by a human.
By accessible I mean by the code.

While trying to reproduce the C++ API in a wrapper using CSFML, we have to hard code the default values.

Then in a future SFML 3.0, if some default values change, the wrappers will remain with the old default values.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 RC
« Reply #216 on: October 08, 2012, 11:17:19 pm »
And how would your macros automatically keep the wrappers up to date? ??? (and what are these "wrappers" by the way?)
Laurent Gomila - SFML developer

fallout

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: SFML 2.0 RC
« Reply #217 on: October 16, 2012, 03:39:22 am »
Not sure if this is a bug, but on Linux (Linux Mint), the tilde key doesn't seem to be recognized, but it's fine on Windows using code:

while ( event loop ) {
   if ( event.type == sf::Event::KeyPressed ) {
        if ( event.key.code == sf::Keyboard::Tilde ) {
            //blah
       }
   }
}
« Last Edit: October 16, 2012, 07:55:29 am by Laurent »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 RC
« Reply #218 on: October 16, 2012, 07:55:12 am »
Please search before posting:
https://github.com/SFML/SFML/issues/7
Laurent Gomila - SFML developer

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: SFML 2.0 RC
« Reply #219 on: October 28, 2012, 10:20:00 pm »
Reinstalled my Ubuntu VM over the weekend and just noticed that CMake is no longer able to find the FindSFML.cmake file installed by SFML. It's obviously put into /usr/local/share/SFML/cmake, which I think has been different in the past? Is this intentional? (pulled from github on this Friday or so)
« Last Edit: October 28, 2012, 10:30:21 pm by Mario »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 RC
« Reply #220 on: October 28, 2012, 10:35:43 pm »
FindSFML.cmake is no longer installed by default, you must copy it.
Laurent Gomila - SFML developer