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

Author Topic: SFML 2.0 RC  (Read 127231 times)

0 Members and 6 Guests are viewing this topic.

Contadotempo

  • Full Member
  • ***
  • Posts: 167
  • Firelink Shrine
    • View Profile
Re: SFML 2.0 RC
« Reply #195 on: September 29, 2012, 12:11:50 am »
Don't know, might have done something wrong cause it just didn't want to generate the needed files. Gave some error I don't remember but that didn't make sense.
Are you using the express edition by any chance? It seems there was a bug with Visual Studio express 2012 and cmake 2.8.9
Take a look at this, it was fixed on cmake 2.8.10:
http://public.kitware.com/Bug/view.php?id=13348

And this for an alternative fix:
http://stackoverflow.com/questions/12434696/visual-studio-express-2012-and-cmake

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML 2.0 RC
« Reply #196 on: September 29, 2012, 12:37:20 am »
Are you using the express edition by any chance?
Well this could likely be, since I'm using Visual Studio 12 Premium (thanks university!). ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

cekota

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: SFML 2.0 RC
« Reply #197 on: September 29, 2012, 11:22:23 am »
Hello,

in "include/SFML/Graphics/Transform.h" we have :

sfTransform sfTransform_Identity;

I have by error modified it. So after this modification it is not an identity matrix anymore.

"const" makes it unmodificable, but still if I provide it by error to a function like sfTransform_rotate() the function will apply silently while actually the operation has not been done without any error reported to the programmer.

So I would suggest to remove "sfTransform_Identity", and provide instead "sfTransform_getIdentity()" :

sfTransform sfTransform_getIdentity(void);

Cheers

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 RC
« Reply #198 on: September 29, 2012, 12:32:55 pm »
Quote
"const" makes it unmodificable, but still if I provide it by error to a function like sfTransform_rotate() the function will apply silently while actually the operation has not been done without any error reported to the programmer.
Hum? Why would it apply silently? It will trigger a compiler error, that's the point of using the const keyword.
Laurent Gomila - SFML developer

cekota

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: SFML 2.0 RC
« Reply #199 on: September 29, 2012, 12:52:26 pm »
Hum? Why would it apply silently? It will trigger a compiler error, that's the point of using the const keyword.

Just remember what CSFML is made for :)

Is it made mainly to write pure plain C ?
Or is its main purpose for something else ?

cekota

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: SFML 2.0 RC
« Reply #200 on: September 29, 2012, 12:53:48 pm »
and this is also why a function would be better.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 RC
« Reply #201 on: September 29, 2012, 02:56:50 pm »
I still don't get it.
Laurent Gomila - SFML developer

cire

  • Full Member
  • ***
  • Posts: 138
    • View Profile
Re: SFML 2.0 RC
« Reply #202 on: September 29, 2012, 06:39:09 pm »
I believe Cekota was suggesting sfTransform_Identity be accessed through a function that supplies a copy of it.

Currently it's not constant and may be changed by a user, and subsequent uses of the identity will (silently) fail to act as one would expect.  The function would make similar scenarios less likely.

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: SFML 2.0 RC
« Reply #203 on: September 29, 2012, 07:20:04 pm »
Quote
Yeye it's always the fault of the software... :P ;D
Or authors. :D
Your mileage may vary but software tends to work weird on some setups. On my laptop vc++2008's intelli sense works alright(generously speaking, I'm having problem with sfg shared ptrs). But on my pc, opening or closing a block with sharp bracket, using scope operator on class that just got a new function added ect. doesn't update itself and I must reopen the solution. There is no apparent reason to this(same windows, same installation, same settings, same files even).
Back to C++ gamedev with SFML in May 2023

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 RC
« Reply #204 on: September 29, 2012, 10:38:18 pm »
Quote
I believe Cekota was suggesting sfTransform_Identity be accessed through a function that supplies a copy of it.

Currently it's not constant and may be changed by a user, and subsequent uses of the identity will (silently) fail to act as one would expect.  The function would make similar scenarios less likely.
But the const keyword solves the problem. That's what I don't understand (he says it doesn't).
Laurent Gomila - SFML developer

cire

  • Full Member
  • ***
  • Posts: 138
    • View Profile
Re: SFML 2.0 RC
« Reply #205 on: September 30, 2012, 03:49:26 am »
I don't know exactly what he meant there, either, unless he's paranoid enough to want protection against people casting away const, in which case -- good luck. 

cekota

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: SFML 2.0 RC
« Reply #206 on: September 30, 2012, 02:06:53 pm »
sorry, I thought it was so evident that CSFML is often used for building bindings to higher level languages, but it seems it is not.

indeed, if the variable is wrapped, then the const qualification is discarded

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 RC
« Reply #207 on: September 30, 2012, 03:35:40 pm »
Ok, but... the binding will also make it const. CSFML is not supposed to solve potential mistakes in bindings that use it.

If I use a function and return a new copy every time it is called, it can even be worse: a binding that would not make the corresponding object const/readonly/whatever, wouldn't see it and it would "work" although the design has a major flaw.

This is purely a design issue, technical choices won't help. The only good solution is to make sure that the objects are const/readonly/... in all the bindings. So thank you for pointing out that they were not in CSFML :)
Laurent Gomila - SFML developer

cekota

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: SFML 2.0 RC
« Reply #208 on: October 07, 2012, 10:58:35 pm »
Ok, but... the binding will also make it const. CSFML is not supposed to solve potential mistakes in bindings that use it.

If I use a function and return a new copy every time it is called, it can even be worse: a binding that would not make the corresponding object const/readonly/whatever, wouldn't see it and it would "work" although the design has a major flaw.

This is purely a design issue, technical choices won't help. The only good solution is to make sure that the objects are const/readonly/... in all the bindings. So thank you for pointing out that they were not in CSFML :)

Well, I don't want to make you change your mind, but I would like to understand, because your are an experienced programmer, and I'm a beginner, so I would really want to understand in order to improve my skills.

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.

So please explain me what I'm supposed to do with this const sfTransform_Identity ?

cekota

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: SFML 2.0 RC
« Reply #209 on: October 07, 2012, 11:01:01 pm »
CSFML: include/SFML/Graphics/Texture.h:
CSFML_GRAPHICS_API void sfTexture_bind(const sfTexture* texture);

SFML: include/SFML/Graphics/Texture.hpp:
void bind(CoordinateType coordinateType = Normalized) const;

The parameter "coordinateType" is missing.