2010-09-01 10:37:10 +00:00
|
|
|
#ifndef TexturePalette_h
|
|
|
|
#define TexturePalette_h
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-09 11:46:38 +00:00
|
|
|
#include <AppKit/AppKit.h>
|
|
|
|
|
|
|
|
#include "QF/qtypes.h"
|
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
typedef union {
|
2010-09-11 10:06:04 +00:00
|
|
|
byte chan[4];
|
|
|
|
unsigned p;
|
2003-03-18 19:48:24 +00:00
|
|
|
} pixel32_t;
|
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
typedef struct {
|
|
|
|
char texture[16];
|
|
|
|
float rotate;
|
|
|
|
float shift[2];
|
|
|
|
float scale[2];
|
2003-03-18 19:48:24 +00:00
|
|
|
} texturedef_t;
|
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
typedef struct {
|
|
|
|
char name[16];
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
NSBitmapImageRep *rep;
|
|
|
|
void *data;
|
|
|
|
pixel32_t flatcolor;
|
2003-03-18 19:48:24 +00:00
|
|
|
} qtexture_t;
|
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
#define MAX_TEXTURES 1024
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
extern int tex_count;
|
|
|
|
extern qtexture_t qtextures[MAX_TEXTURES];
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-28 09:41:38 +00:00
|
|
|
qtexture_t *TEX_ForName (const char *name);
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
typedef struct {
|
|
|
|
NSImageRep *image;
|
2010-09-11 10:06:04 +00:00
|
|
|
NSRect r;
|
2010-09-29 20:09:11 +00:00
|
|
|
char *name;
|
2010-09-11 10:06:04 +00:00
|
|
|
int index;
|
2010-09-29 20:09:11 +00:00
|
|
|
int display; // flag (on/off)
|
2003-03-18 19:48:24 +00:00
|
|
|
} texpal_t;
|
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
#define TEX_INDENT 10
|
|
|
|
#define TEX_SPACING 16
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
extern id texturepalette_i;
|
2010-09-11 10:06:04 +00:00
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
@interface TexturePalette: NSObject
|
2010-09-11 16:41:18 +00:00
|
|
|
{
|
2010-09-29 20:09:11 +00:00
|
|
|
char currentwad[1024];
|
|
|
|
id textureList_i;
|
|
|
|
id textureView_i;
|
|
|
|
id searchField_i;
|
|
|
|
id sizeField_i;
|
|
|
|
|
|
|
|
id field_Xshift_i;
|
|
|
|
id field_Yshift_i;
|
|
|
|
id field_Xscale_i;
|
|
|
|
id field_Yscale_i;
|
|
|
|
id field_Rotate_i;
|
|
|
|
|
|
|
|
int viewWidth;
|
|
|
|
int viewHeight;
|
|
|
|
int selectedTexture;
|
2003-03-18 19:48:24 +00:00
|
|
|
}
|
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
- (const char *) currentWad;
|
|
|
|
- (id) initPaletteFromWadfile: (const char *)wf;
|
|
|
|
- (id) computeTextureViewSize;
|
|
|
|
- (id) alphabetize;
|
|
|
|
- (id) getList;
|
|
|
|
- (int) getSelectedTexture;
|
|
|
|
- (id) setSelectedTexture: (int)which;
|
|
|
|
- (int) getSelectedTexIndex;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
|
|
|
// Called externally
|
2010-09-29 20:09:11 +00:00
|
|
|
- (const char *) getSelTextureName;
|
|
|
|
- (id) setTextureByName: (const char *)name;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
|
|
|
// New methods to replace the 2 above ones
|
2010-09-29 20:09:11 +00:00
|
|
|
- (id) setTextureDef: (texturedef_t *)td;
|
|
|
|
- (id) getTextureDef: (texturedef_t *)td;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
|
|
|
// Action methods
|
2010-09-29 20:09:11 +00:00
|
|
|
- (id) searchForTexture: sender;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
- (id) clearTexinfo: sender;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
- (id) incXShift: sender;
|
|
|
|
- (id) decXShift: sender;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
- (id) incYShift: sender;
|
|
|
|
- (id) decYShift: sender;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
- (id) incRotate: sender;
|
|
|
|
- (id) decRotate: sender;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
- (id) incXScale: sender;
|
|
|
|
- (id) decXScale: sender;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
- (id) incYScale: sender;
|
|
|
|
- (id) decYScale: sender;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
- (id) texturedefChanged: sender;
|
|
|
|
- (id) onlyShowMapTextures: sender;
|
|
|
|
- (int) searchForTextureInPalette: (const char *)texture;
|
|
|
|
- (id) setDisplayFlag: (int)index
|
|
|
|
to: (int)value;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
|
|
|
@end
|
2010-09-11 10:06:04 +00:00
|
|
|
#endif // TexturePalette_h
|