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

Author Topic: Inheriting from Drawable  (Read 3551 times)

0 Members and 1 Guest are viewing this topic.

Megatron

  • Newbie
  • *
  • Posts: 22
    • View Profile
Inheriting from Drawable
« on: July 11, 2010, 06:08:57 am »
Sorry to ask so many questions lately, just anxious to learn SFML in .NET

Could someone tell me how you inherit from Drawable in .NET? When I derives from it the base Drawable Constructor asks for an IntPtr called thisPtr. I assumed that was a pointer to the object currently being constructed. I'm not sure how to get a pointer to the object. I tried using GCHandle and "this", but "this" isn't a valid constructor parameter. I looked at the source code for the .NET Sprite class as it inherits from Drawable, but it calls part of the SFML library. If someone could tell me how to do this/point in the right direction that'd be great. Thanks

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Inheriting from Drawable
« Reply #1 on: July 11, 2010, 12:02:41 pm »
This is impossible, because the .Net binding is based on the C binding, and the latter doesn't support polymorphism. So, while the C++ API supports drawing any drawable class, the C API is limited to the classes that exist in SFML (Shape, Text, Sprite).
Laurent Gomila - SFML developer

 

anything