31 |
@implementation UiImage |
@implementation UiImage |
32 |
|
|
33 |
/** |
/** |
34 |
* Initialise the image at a position. |
* Initializes the image at position. |
35 |
* Returns nil if the image can't be created. |
* Returns nil if the image can't be created. |
36 |
*/ |
*/ |
37 |
- (id) initWithImageName: (NSString *)imageName |
- (id) initWithImageName: (NSString *)imageName |
63 |
[self setSize: [[TextureLoader defaultLoader] textureSize: _imageName]]; |
[self setSize: [[TextureLoader defaultLoader] textureSize: _imageName]]; |
64 |
} |
} |
65 |
|
|
66 |
|
/** |
67 |
|
* Displays the image. |
68 |
|
*/ |
69 |
- (void) _display |
- (void) _display |
70 |
{ |
{ |
71 |
NSSize size = [self size]; |
NSSize size = [self size]; |
77 |
|
|
78 |
glBindTexture (GL_TEXTURE_2D, _texture); |
glBindTexture (GL_TEXTURE_2D, _texture); |
79 |
|
|
80 |
glColor3f (1.0f, 1.0f, 1.0f); |
glColor4f (1.0f, 1.0f, 1.0f, [self alpha]); |
81 |
|
|
82 |
glBegin (GL_POLYGON); |
glBegin (GL_POLYGON); |
83 |
glTexCoord2f (0.0f, 1.0f); glVertex2f (0.0f, 0.0f); |
glTexCoord2f (0.0f, 1.0f); glVertex2f (0.0f, 0.0f); |