Oolite 1.91.0.7645-241119-222d325
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

OOTexturetexture
 
NSSize size
 

Detailed Description

Definition at line 35 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 1 of file OOTextureSprite.m.

110 :(float)x Y:(float)y Z:(float)z alpha:(float)a
111{
112 // Without distance, coriolis stations would be rendered behind the background image.
113 // Set an arbitrary value for distance, might not be sufficient for really huge ships.
114 float distance = 512.0f;
115
116 size.width *= distance; size.height *= distance;
117 [self blitCentredToX:x Y:y Z:z * distance alpha:a];
118 size.width /= distance; size.height /= distance;
119}
float y
float x
voidpf void uLong size
Definition ioapi.h:134

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

+ Here is the call graph for this function:

◆ blitCentredToX:Y:Z:alpha:

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

Definition at line 1 of file OOTextureSprite.m.

102 :(float)x Y:(float)y Z:(float)z alpha:(float)a
103{
104 float xs = x - size.width / 2.0;
105 float ys = y - size.height / 2.0;
106 [self blitToX:xs Y:ys Z:z alpha:a];
107}

◆ blitToX:Y:Z:alpha:

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

Definition at line 1 of file OOTextureSprite.m.

70 :(float)x Y:(float)y Z:(float)z alpha:(float)a
71{
74
75 a = OOClamp_0_1_f(a);
76 OOGL(glEnable(GL_TEXTURE_2D));
77 OOGL(glColor4f(1.0, 1.0, 1.0, a));
78
79 // Note that the textured Quad is drawn ACW from the top left.
80
81 [texture apply];
82 OOGLBEGIN(GL_QUADS);
83 glTexCoord2f(0.0, 0.0);
84 glVertex3f(x, y+size.height, z);
85
86 glTexCoord2f(0.0, 1.0);
87 glVertex3f(x, y, z);
88
89 glTexCoord2f(1.0, 1.0);
90 glVertex3f(x+size.width, y, z);
91
92 glTexCoord2f(1.0, 0.0);
93 glVertex3f(x+size.width, y+size.height, z);
94 OOGLEND();
95
96 OOGL(glDisable(GL_TEXTURE_2D));
97
99}
#define OO_ENTER_OPENGL()
#define OOGLBEGIN
Definition OOOpenGL.h:253
@ OPENGL_STATE_OVERLAY
Definition OOOpenGL.h:126
#define OOVerifyOpenGLState()
Definition OOOpenGL.h:136
#define OOSetOpenGLState(STATE)
Definition OOOpenGL.h:135
#define OOGL(statement)
Definition OOOpenGL.h:251
#define OOGLEND
Definition OOOpenGL.h:254

◆ dealloc

- (void) dealloc
implementation

Definition at line 1 of file OOTextureSprite.m.

58{
59 [texture release];
60
61 [super dealloc];
62}

◆ initWithTexture:

- (id) initWithTexture: (OOTexture *) texture

Definition at line 1 of file OOTextureSprite.m.

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

◆ initWithTexture:size:

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

Definition at line 1 of file OOTextureSprite.m.

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

Referenced by blitBackgroundCentredToX:Y:Z:alpha:.

+ Here is the caller graph for this function:

◆ size

- (NSSize) size

Member Data Documentation

◆ size

- (NSSize) size
private

Definition at line 39 of file OOTextureSprite.h.

◆ texture

- (OOTexture*) texture
private

Definition at line 38 of file OOTextureSprite.h.


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