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...

#include <Flyweight_Classes.h>

Collaboration diagram for Flyweight_Context:
Collaboration graph

Public Member Functions

 Flyweight_Context ()
 Default constructor.
 
 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.cpp). The Flyweight_Class just holds onto the context.

Definition at line 28 of file Flyweight_Classes.h.

Constructor & Destructor Documentation

◆ Flyweight_Context() [1/2]

Flyweight_Context ( )
inline

Default constructor.

Definition at line 41 of file Flyweight_Classes.h.

◆ Flyweight_Context() [2/2]

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 63 of file Flyweight_Classes.h.

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

◆ ImageWidth

int ImageWidth

◆ OffsetXToImage

int OffsetXToImage

Definition at line 30 of file Flyweight_Classes.h.

Referenced by Flyweight_Context::Flyweight_Context().

◆ Position_X

double Position_X

Definition at line 33 of file Flyweight_Classes.h.

Referenced by Flyweight_Context::Flyweight_Context().

◆ Position_Y

double Position_Y

Definition at line 34 of file Flyweight_Classes.h.

Referenced by Flyweight_Context::Flyweight_Context().

◆ Velocity_X

double Velocity_X

Definition at line 35 of file Flyweight_Classes.h.

Referenced by Flyweight_Context::Flyweight_Context().

◆ Velocity_Y

double Velocity_Y

Definition at line 36 of file Flyweight_Classes.h.

Referenced by Flyweight_Context::Flyweight_Context().


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