Design Pattern Examples
Overview of object-oriented design patterns
Flyweight_Context Struct Reference

Represents the context for an instance of the Flyweight_Class. In this case, the context includes position and velocity. More...

Collaboration diagram for Flyweight_Context:
Collaboration graph

Public Member Functions

 Flyweight_Context (int offset_x, int image_width, int image_height, double position_x, double position_y, double velocity_x, double velocity_y)
 Constructor.
 

Public Attributes

int OffsetXToImage
 
int ImageWidth
 
int ImageHeight
 
double Position_X
 
double Position_Y
 
double Velocity_X
 
double Velocity_Y
 

Detailed Description

Represents the context for an instance of the Flyweight_Class. In this case, the context includes position and velocity.

This context is manipulated outside the Flyweight_Class by the controlling entity (in this case, the exercise in Program.cs). The Flyweight_Class just holds onto the context.

Definition at line 21 of file Flyweight_Class.cs.

Constructor & Destructor Documentation

◆ Flyweight_Context()

Flyweight_Context ( int  offset_x,
int  image_width,
int  image_height,
double  position_x,
double  position_y,
double  velocity_x,
double  velocity_y 
)
inline

Constructor.

Parameters
offset_xOffset from left edge of big resource image to the left edge of the image for this context.
image_widthWidth of image for this context.
image_heightHeight of image for this context.
position_xX position of the top left corner of the big resource.
position_yY position of the top left corner of the big resource.
velocity_xInitial X velocity.
velocity_yInitial Y velocity.

Definition at line 42 of file Flyweight_Class.cs.

References Flyweight_Context.ImageHeight, Flyweight_Context.ImageWidth, Flyweight_Context.OffsetXToImage, Flyweight_Context.Position_X, Flyweight_Context.Position_Y, Flyweight_Context.Velocity_X, and Flyweight_Context.Velocity_Y.

Member Data Documentation

◆ ImageHeight

int ImageHeight

Definition at line 25 of file Flyweight_Class.cs.

Referenced by Flyweight_Context.Flyweight_Context().

◆ ImageWidth

int ImageWidth

Definition at line 24 of file Flyweight_Class.cs.

Referenced by Flyweight_Context.Flyweight_Context().

◆ OffsetXToImage

int OffsetXToImage

◆ Position_X

double Position_X

◆ Position_Y

double Position_Y

◆ Velocity_X

double Velocity_X

◆ Velocity_Y

double Velocity_Y

The documentation for this struct was generated from the following file: