Oolite
Loading...
Searching...
No Matches
OOTextureSprite Class Reference

#include <OOTextureSprite.h>

Inheritance diagram for OOTextureSprite:
Collaboration diagram for OOTextureSprite:

Instance Methods

(id) - initWithTexture:
(id) - initWithTexture:size:
(NSSize) - size
(void) - blitToX:Y:Z:alpha:
(void) - blitCentredToX:Y:Z:alpha:
(void) - blitBackgroundCentredToX:Y:Z:alpha:
(void) - dealloc [implementation]

Private Attributes

OOTexture * texture
NSSize size

Detailed Description

Definition at line 33 of file OOTextureSprite.h.

Method Documentation

◆ blitBackgroundCentredToX:Y:Z:alpha:

- (void) blitBackgroundCentredToX: (float) x
Y: (float) y
Z: (float) z
alpha: (float) a 

Definition at line 102 of file OOTextureSprite.m.

102 :(float)x Y:(float)y Z:(float)z alpha:(float)a
103{
104 // Without distance, coriolis stations would be rendered behind the background image.
105 // Set an arbitrary value for distance, might not be sufficient for really huge ships.
106 float distance = 512.0f;
107
108 size.width *= distance;
109 size.height *= distance;
110 [self blitCentredToX:x Y:y Z:z * distance alpha:a];
111 size.width /= distance;
112 size.height /= distance;
113}
float y
float x
OOINLINE OOScalar distance(Vector v1, Vector v2) INLINE_CONST_FUNC
Definition OOVector.h:280

References blitCentredToX:Y:Z:alpha:, distance(), and size.

Referenced by GuiDisplayGen::drawGUIBackground.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ blitCentredToX:Y:Z:alpha:

- (void) blitCentredToX: (float) x
Y: (float) y
Z: (float) z
alpha: (float) a 

Definition at line 95 of file OOTextureSprite.m.

95 :(float)x Y:(float)y Z:(float)z alpha:(float)a
96{
97 float xs = x - size.width / 2.0;
98 float ys = y - size.height / 2.0;
99 [self blitToX:xs Y:ys Z:z alpha:a];
100}

References blitToX:Y:Z:alpha:, size, x, and y.

Referenced by blitBackgroundCentredToX:Y:Z:alpha:, HeadUpDisplay(Private)::drawCustomImage:, and HeadUpDisplay(Private)::drawLegend:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ blitToX:Y:Z:alpha:

- (void) blitToX: (float) x
Y: (float) y
Z: (float) z
alpha: (float) a 

Definition at line 64 of file OOTextureSprite.m.

64 :(float)x Y:(float)y Z:(float)z alpha:(float)a
65{
68
69 a = OOClamp_0_1_f(a);
70 OOGL(glEnable(GL_TEXTURE_2D));
71 OOGL(glColor4f(1.0, 1.0, 1.0, a));
72
73 // Note that the textured Quad is drawn ACW from the top left.
74
75 [texture apply];
76 OOGLBEGIN(GL_QUADS);
77 glTexCoord2f(0.0, 0.0);
78 glVertex3f(x, y + size.height, z);
79
80 glTexCoord2f(0.0, 1.0);
81 glVertex3f(x, y, z);
82
83 glTexCoord2f(1.0, 1.0);
84 glVertex3f(x + size.width, y, z);
85
86 glTexCoord2f(1.0, 0.0);
87 glVertex3f(x + size.width, y + size.height, z);
88 OOGLEND();
89
90 OOGL(glDisable(GL_TEXTURE_2D));
91
93}
OOINLINE float OOClamp_0_1_f(float value) INLINE_CONST_FUNC
#define OO_ENTER_OPENGL()
#define OOGLBEGIN
Definition OOOpenGL.h:269
@ OPENGL_STATE_OVERLAY
Definition OOOpenGL.h:124
#define OOVerifyOpenGLState()
Definition OOOpenGL.h:133
#define OOSetOpenGLState(STATE)
Definition OOOpenGL.h:132
#define OOGL(statement)
Definition OOOpenGL.h:262
#define OOGLEND
Definition OOOpenGL.h:270

References OOTexture::apply, OO_ENTER_OPENGL, OOClamp_0_1_f(), OOGL, OOGLBEGIN, OOGLEND, OOSetOpenGLState, OOVerifyOpenGLState, OPENGL_STATE_OVERLAY, size, x, and y.

Referenced by blitCentredToX:Y:Z:alpha:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dealloc

- (void) dealloc
implementation

Definition at line 52 of file OOTextureSprite.m.

53{
54 [texture release];
55
56 [super dealloc];
57}

References dealloc.

Referenced by dealloc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initWithTexture:

- (id) initWithTexture: (OOTexture*) texture

Definition at line 32 of file OOTextureSprite.m.

32 :(OOTexture*)inTexture
33{
34 return [self initWithTexture:inTexture size:[inTexture originalDimensions]];
35}

References initWithTexture:size:, and OOTexture::originalDimensions.

Here is the call graph for this function:

◆ initWithTexture:size:

- (id) initWithTexture: (OOTexture*) texture
size: (NSSize) spriteSize 

Definition at line 37 of file OOTextureSprite.m.

37 :(OOTexture*)inTexture size:(NSSize)spriteSize
38{
39 if (inTexture == nil) {
40 [self release];
41 return nil;
42 }
43
44 self = [super init];
45 if (self != nil) {
46 texture = [inTexture retain];
47 size = spriteSize;
48 }
49 return self;
50}
return nil
OOTexture * texture

References nil, size, and texture.

Referenced by initWithTexture:.

Here is the caller graph for this function:

◆ size

- (NSSize) size

References size.

Member Data Documentation

◆ size

- (NSSize) size
private

◆ texture

- (OOTexture*) texture
private

Definition at line 35 of file OOTextureSprite.h.

Referenced by initWithTexture:size:.


The documentation for this class was generated from the following files: