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

Author Topic: A few design questions  (Read 5904 times)

0 Members and 1 Guest are viewing this topic.

Chris12

  • Newbie
  • *
  • Posts: 20
    • View Profile
A few design questions
« on: March 02, 2012, 09:35:54 pm »
Why is renderWindow.Height and Width "uint" instead of "int" ?
Sure, they cant be negative, but the casts are unnecessary.
Size, Rectangle and other classes / structs in the DotNet environment are just int to make handling easier (no casts).
Is there any real reason to keep uint ?

The next thing is less a question, more like a bugreport.
The Events of "RenderWindow" shold begin with "OnX"
That means, OnResize, OnLostFocus, OnWhateverHappend.
See: http://msdn.microsoft.com/en-us/library/ms229045.aspx


Is CPointer of any use in the .NET environment ?
Of course it might be needed to have the pointer to the object ready in case its needed by the wrapper.
But that's and implementation detail, which should be "private".
Unless of course you can do something nice with it. (Please explain)

What do PushGLStates(), PopGLStates() and ResetGLStates() do?
When should they be used? What can they be used for?

What direction is "up" ?
Mouse coordinates are returned with +Y equals downwards, that also matches with how vertices are defined.
But shouldn't +Y be upwards in openGL ? Is this a SFML specific thing ?
I don't care what way is upwards as long as it is consistent over all the stuff that SFML provides.

Btw:
Is there any way to clip stuff ? Like a clip region ?
I've seen that in some other engines.
I think its drawing to the stencil buffer, then setting the stencil buffer as blend mode or something like that.
Or is the only available way for this using RenderTextures?
I don't have anything against them, but is there a limit on how many of those you can use ?

Thanks for the awesome libaray btw.
I really love it.

omeg

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • http://omeg.pl/
A few design questions
« Reply #1 on: March 02, 2012, 09:41:52 pm »
As for event naming see http://msdn.microsoft.com/en-us/library/ms229012.aspx
Quote
Names of Events

Do name events with a verb or a verb phrase.

Do give event names a concept of before and after, using the present and past tense. For example, a close event that is raised before a window is closed would be called Closing and one that is raised after the window is closed would be called Closed.

Do not use Before or After prefixes or suffixes to indicate pre and post events.

Do name event handlers (delegates used as types of events) with the EventHandler suffix.

Do use two parameters named sender and e in event handler signatures.

The sender parameter should be of type Object, and the e parameter should be an instance of or inherit from EventArgs.

Do name event argument classes with the EventArgs suffix.

This convention is used in the BCL.

Chris12

  • Newbie
  • *
  • Posts: 20
    • View Profile
A few design questions
« Reply #2 on: March 02, 2012, 09:51:57 pm »
Ah ok, you are right,
I just  thought this one is the correct link
http://msdn.microsoft.com/en-us/library/ms229042.aspx
because it said:
"Design Guidelines for Developing Class Libraries"

It's not really a problem anyway :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
A few design questions
« Reply #3 on: March 02, 2012, 10:24:00 pm »
Quote
Is there any real reason to keep uint ?

The question is: why should it be int, and give the false impression that they can be negative?
It makes you use more casts but is it a good reason to change the type? I don't think so.

Quote
Is CPointer of any use in the .NET environment ?

No. It's purely an implementation detail but since it's used across modules it cannot be internal or private. It has to be public.

Quote
What do PushGLStates(), PopGLStates() and ResetGLStates() do?
When should they be used? What can they be used for?

There's a documentation for this kind of questions ;)

Quote
Mouse coordinates are returned with +Y equals downwards, that also matches with how vertices are defined.
But shouldn't +Y be upwards in openGL ? Is this a SFML specific thing ?

It is specific to SFML (I have to choose one or the other because I don't provide maximum flexibility like OpenGL does), and it is of course consistent.

Quote
Is there any way to clip stuff ? Like a clip region ?

Not yet, but it's planned for SFML 2.1 or 2.2.
In the meantime you can fake it by playing with views and their viewport.
Laurent Gomila - SFML developer

luiscubal

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
A few design questions
« Reply #4 on: March 07, 2012, 12:50:07 am »
Quote
The question is: why should it be int

Unsigned types are not "CLSCompliant".
I'm not sure how many CLR languages that causes trouble in, though. If you only want to support C# and VB, that won't be an issue.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
A few design questions
« Reply #5 on: March 07, 2012, 08:00:10 am »
Quote
Unsigned types are not "CLSCompliant"

What does that mean?
Laurent Gomila - SFML developer

luiscubal

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
A few design questions
« Reply #6 on: March 08, 2012, 07:31:51 pm »
Quote from: "Laurent"
Quote
Unsigned types are not "CLSCompliant"

What does that mean?


MSDN: http://msdn.microsoft.com/en-us/library/bhc3fa7f.aspx

I believe it's related to languages such as the (now obsolete) J#. CLSCompliance refers to a minimum subset of features that all "CLSCompliant languages" must support.

In practice, I don't know how much of an issue this is, since my experience with .NET has been mostly C#.