示例#1
0
void loadExternalTextures()
{
	// Local storage for bmp image data.
	BitMapFile *image[2];
   
	image[0] = getbmp("space.bmp");
	image[1] = getbmp("cat.bmp");
	
	// Bind cat image to texture object internalTextures[0]. 
   glBindTexture(GL_TEXTURE_2D, externalTextures[0]); 
   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image[0]->sizeX, image[0]->sizeY, 0, 
	            GL_RGBA, GL_UNSIGNED_BYTE, image[0]->data);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
   glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
   glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);

   // Bind space image to texture object internalTextures[1]
   glBindTexture(GL_TEXTURE_2D, externalTextures[1]);
   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image[1]->sizeX, image[1]->sizeY, 0, 
	            GL_RGBA, GL_UNSIGNED_BYTE, image[1]->data);		
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);		
}
示例#2
0
ScrollBar::ScrollBar(TWindow *menu, char *identbranch)
:
AreaTablet(menu, identbranch, 255)
{
	STACKTRACE;
	relpos = 0.0;				 // between 0 and 1

	button = getbmp("button");

	if (button) {
		bwhalf = button->w/2;
		bhhalf = button->h/2;
	} else {
		bwhalf = 0;
		bhhalf = 0;
	}

	if (size.y >= size.x)
		direction = ver;		 // vertically oriented
	else
		direction = hor;		 // horizontally oriented

	if (direction == ver) {
		pmin = bhhalf;
		pmax = iround(size.y - bhhalf);
	} else {
		pmin = bwhalf;
		pmax = iround(size.x - bwhalf);
	}

	pbutton = pmin;
}
示例#3
0
MatrixIcons::MatrixIcons(TWindow *menu, const char *identbranch, int akey)
:
AreaTabletScrolled(menu, identbranch, akey)
{
	STACKTRACE;

	scroll.set(0, 0, 1, 1, 1, 1);

	// obtain the overlay ... this defines the width/height of each matrix area

	overlay = getbmp("overlay");
	if (!overlay) {
		tw_error("MatrixIcons : overlay is missing");
	}

	tmp = create_bitmap(overlay->w, overlay->h);

	maxitems = 0;
	Nx = 0;
	Ny = 0;

	Wicon = overlay->w;
	Hicon = overlay->h;

	Nxshow = iround( size.x / double(Wicon) );
	Nyshow = iround( size.y / double(Hicon) );

	itemproperty = 0;
}
示例#4
0
SwitchButton::SwitchButton(TWindow *menu, const char *identbranch, int asciicode, bool initialstate)
:
GraphicButton(menu, identbranch, asciicode)
{
	STACKTRACE;
	init_pos_size(&bmp_on, "on");
	bmp_off = getbmp("off");

	state = initialstate;
}
示例#5
0
REGISTER_FILE

#include "twwindow.h"
#include "twbuttontypes.h"

// to implement a Button, you add bitmaps-feedback to the box-area control
// name#default.bmp
// name#focus.bmp
// name#selected.bmp

Button::Button(TWindow *menu, const char *identbranch, int asciicode, bool akeepkey)
:
GraphicButton(menu, identbranch, asciicode, akeepkey)
{
	STACKTRACE;
	init_pos_size(&bmp_default, "default");

	bmp_focus = getbmp("focus");
	bmp_selected = getbmp("selected");
}