Click here to Skip to main content
15,922,427 members
Home / Discussions / C#
   

C#

 
GeneralRe: string.split problem Pin
livez2-Jun-05 2:16
livez2-Jun-05 2:16 
GeneralWeb service timeout Pin
Chals2-Jun-05 1:21
Chals2-Jun-05 1:21 
GeneralRe: Web service timeout Pin
S. Senthil Kumar2-Jun-05 1:24
S. Senthil Kumar2-Jun-05 1:24 
GeneralRe: Web service timeout Pin
Chals2-Jun-05 1:31
Chals2-Jun-05 1:31 
GeneralWindow Proc Pin
Sabry19052-Jun-05 1:07
Sabry19052-Jun-05 1:07 
GeneralRe: Window Proc Pin
S. Senthil Kumar2-Jun-05 1:22
S. Senthil Kumar2-Jun-05 1:22 
GeneralC# and Outlook Navigation Pane. Pin
HakunaMatada2-Jun-05 0:17
HakunaMatada2-Jun-05 0:17 
GeneralOOP design pattern Pin
Jonas Beckeman (2)1-Jun-05 23:16
Jonas Beckeman (2)1-Jun-05 23:16 
(design pattern terminology newbie warning!)

I'm porting a sprite engine and multimedia toolbox, Endogine, which I've written in Director (see www.endogine.com) to C#, and I have to change the structure a bit because of the language differences.

In Lingo (Director's scripting language), it's possible to switch base classes in runtime, which is something I use a lot in Endogine.

Here's how:

The sprites can be rendered either by blitting bitmaps to the screen, or by using textured 3D planes. In the C# version, I support GDI+, DirectDraw and Direct3D.

Naturally, for each rendering method, different code is needed, and to solve this I've written a separate Sprite class (derived from the virtual SpriteBase) for each rendering method.

Now I want to derive other classes from these 3, say a BouncingSprite which moves around the screen. Depending on the rendering mode, a different base class must be used. In Lingo, I could define the base class in runtime (3D mode? OK, use Sprite3D as base class), but obviously this isn't allowed in C#.


Which is the most common way to go about this? (I don't just want it to work, I want it to use well-known design patterns

Interfaces could help, but I don't know much about them.

Should I avoid inheritance for the 3 types of rendering and write 3 separate "SpriteRenderMethodSpecific" helper classes (and a base class for them) so the Sprite class can choose which to instantiate in runtime? (Or is that pattern called Adapters..?)

TIA
GeneralRe: OOP design pattern Pin
Colin Angus Mackay2-Jun-05 1:09
Colin Angus Mackay2-Jun-05 1:09 
GeneralRe: OOP design pattern Pin
Jonas Beckeman (2)2-Jun-05 2:11
Jonas Beckeman (2)2-Jun-05 2:11 
GeneralChecking Modem and LAN Connection Pin
ksanju10001-Jun-05 21:24
ksanju10001-Jun-05 21:24 
GeneralUnderlining text in buttons Pin
livez1-Jun-05 20:54
livez1-Jun-05 20:54 
GeneralRe: Underlining text in buttons Pin
mav.northwind1-Jun-05 21:20
mav.northwind1-Jun-05 21:20 
GeneralRe: Underlining text in buttons Pin
Susan Hernandez3-Jun-05 14:37
Susan Hernandez3-Jun-05 14:37 
Generali wanna help Pin
Member 14597831-Jun-05 20:36
Member 14597831-Jun-05 20:36 
GeneralRe: i wanna help Pin
Anonymous2-Jun-05 6:37
Anonymous2-Jun-05 6:37 
GeneralRe: i wanna help Pin
Dave Kreskowiak2-Jun-05 7:19
mveDave Kreskowiak2-Jun-05 7:19 
GeneralRe: i wanna help Pin
Dave Kreskowiak3-Jun-05 5:12
mveDave Kreskowiak3-Jun-05 5:12 
QuestionSystem.Uri bug?? Pin
Jason Manfield1-Jun-05 14:30
Jason Manfield1-Jun-05 14:30 
AnswerRe: System.Uri bug?? Pin
Miszou2-Jun-05 8:52
Miszou2-Jun-05 8:52 
GeneralRe: System.Uri bug?? Pin
Jason Manfield2-Jun-05 9:19
Jason Manfield2-Jun-05 9:19 
GeneralAccess 2000 and C# Pin
Tom Wright1-Jun-05 12:04
Tom Wright1-Jun-05 12:04 
GeneralRe: Access 2000 and C# Pin
Christian Graus1-Jun-05 12:09
protectorChristian Graus1-Jun-05 12:09 
GeneralRe: Access 2000 and C# Pin
Dave Kreskowiak2-Jun-05 7:15
mveDave Kreskowiak2-Jun-05 7:15 
GeneralInvokeMember problem Pin
Eirik Hoem1-Jun-05 11:44
sussEirik Hoem1-Jun-05 11:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.