Ejemplo n.º 1
0
/* draw the keyboard at the current position */
void 
danzeff_render(int transparent)
{
  dirty = false;
  
  ///Draw the background for the selected keyboard either transparent or opaque
  ///this is the whole background image, not including the special highlighted area
  //if center is selected then draw the whole thing opaque
  int index = (mode*2 + shifted) % MAX_VKEYBOARD;
  if ((selected_x == 1 && selected_y == 1) && (! transparent)) {
    surface_draw(keyBits[index*3]);
  } else {
    surface_draw(keyBits[index*3 + 1]);
  }
  
  if ((selected_x != 1) || (selected_y != 1) || (! transparent)) {
    ///Draw the current Highlighted Selector (orange bit)
    surface_draw_offset(keyBits[index*3 + 2], 
    //Offset from the current draw position to render at
    selected_x*43, selected_y*43, 
    //internal offset of the image
    selected_x*64,selected_y*64,
    //size to render (always the same)
    64, 64);
  }
}
Ejemplo n.º 2
0
Archivo: widget.c Proyecto: jxv/finite
void boardWidgetDraw(IO *io, GridWidget *bw, player_t *p, board_t *b, TransMove *tm, LastMove *lm, coor_t dim)
{
	tile_t *t;
	SDL_Surface *ts;
coor_t idx;
	TileLookType tlt;
	int i;

	NOT(io);
	NOT(bw);
	NOT(p);
	NOT(b);
	NOT(tm);

	for (idx.y = 0; idx.y < BOARD_Y; idx.y++) {
		for (idx.x = 0; idx.x < BOARD_X; idx.x++) {
			surface_draw(io->screen, io->sq[b->sq[idx.y][idx.x]], idx.x * dim.x + bw->pos.x, idx.y * dim.y + bw->pos.y);
			t = &b->tile[idx.y][idx.x];
			if (t->type != TILE_NONE) {
				tlt = lm->type == lastMovePlace && lm->data.place[idx.y][idx.x] ? tileLookLast : tileLookNormal;
				ts = io->tile[t->type][t->letter][tlt];
				surface_draw(io->screen, ts, idx.x * dim.x + bw->pos.x, idx.y * dim.y + bw->pos.y);
			}
		}
	}

	switch (tm->type) {
	case transMovePlace:
	case transMovePlaceWild:
	case transMovePlacePlay:
	case transMovePlaceEnd: {
		int j;
		for (i = 0; i < RACK_SIZE; i++) {
			j = tm->adjust.data.tile[i].idx;
			idx = tm->place.boardIdx[j];
			if (valid_board_idx(idx)) {
				t = &p->tile[tm->adjust.data.tile[tm->place.rackIdx[idx.y][idx.x]].idx];
				ts = io->tile[t->type][t->letter][tileLookHold];
				surface_draw(io->screen, ts, idx.x * dim.x + bw->pos.x, idx.y * dim.y + bw->pos.y);
			}
		}
		break;
	}
	default: break;
	}

}
Ejemplo n.º 3
0
/* draw the keyboard at the current position */
void 
danzeff_render()
{
	dirty = false;
	
	///Draw the background for the selected keyboard either transparent or opaque
	///this is the whole background image, not including the special highlighted area
	//if center is selected then draw the whole thing opaque
	if (selected_x == 1 && selected_y == 1)
		surface_draw(keyBits[6*mode + shifted*3]);
	else
		surface_draw(keyBits[6*mode + shifted*3 + 1]);
	
	///Draw the current Highlighted Selector (orange bit)
	surface_draw_offset(keyBits[6*mode + shifted*3 + 2], 
	//Offset from the current draw position to render at
	selected_x*43, selected_y*43, 
	//internal offset of the image
	selected_x*64,selected_y*64,
	//size to render (always the same)
	64, 64);
}
Ejemplo n.º 4
0
Archivo: widget.c Proyecto: jxv/finite
void boardWidgetDrawWithoutTransMove(IO *io, GridWidget *bw, board_t *b, LastMove *lm, coor_t dim)
{
	tile_t *t;
	SDL_Surface *ts;
coor_t idx;
	TileLookType tlt;

	NOT(io);
	NOT(bw);
	NOT(b);

	for (idx.y = 0; idx.y < BOARD_Y; idx.y++) {
		for (idx.x = 0; idx.x < BOARD_X; idx.x++) {
			surface_draw(io->screen, io->sq[b->sq[idx.y][idx.x]], idx.x * dim.x + bw->pos.x, idx.y * dim.y + bw->pos.y);
			t = &b->tile[idx.y][idx.x];
			if (t->type != TILE_NONE) {
				tlt = lm->type == lastMovePlace && lm->data.place[idx.y][idx.x] ? tileLookLast : tileLookNormal;
				ts = io->tile[t->type][t->letter][tlt];
				surface_draw(io->screen, ts, idx.x * dim.x + bw->pos.x, idx.y * dim.y + bw->pos.y);
			}
		}
	}

}
Ejemplo n.º 5
0
Archivo: widget.c Proyecto: jxv/finite
void rackWidgetDraw(IO *io, TransMove *tm, GridWidget *rw, coor_t dim,
		    player_t *p)
{
	tile_t *t;
	tile_tag_t tt;
	SDL_Surface *s;

	NOT(io);
	NOT(tm);
	NOT(p);

	switch (tm->type) {
	case transMovePlace:
	case transMovePlacePlay:
	case transMovePlaceWild:
		for (int i = 0; i < RACK_SIZE; i++) {
			t = &p->tile[tm->adjust.data.tile[i].idx];
			if (t->type == TILE_NONE)
				continue;
			s = NULL;
			if (tm->place.idx != i) {
				if (!valid_board_idx(tm->place.boardIdx[i])) {
					tt = tileLookNormal;
					s = t->type == TILE_WILD
						? io->wild[tt]
						: io->tile[t->type][t->letter]
						          [tt];
				}
			} else {
				tt = tileLookHold;
				s = t->type == TILE_WILD
					? io->wild[tt]
					: io->tile[t->type][t->letter][tt];
			}
			if (s)
				surface_draw(io->screen, s,
					     i * dim.x + rw->pos.x, rw->pos.y);
		}
		break;
	case transMovePlaceEnd:
		break;
	case transMoveDiscard:
		for (int i = 0; i < RACK_SIZE; i++) {
			t = &p->tile[tm->adjust.data.tile[i].idx];
			if (t->type == TILE_NONE)
				continue;
			tt = tm->discard.rack[i]
				? tileLookDisable : tileLookNormal;
			s = t->type == TILE_WILD
				? io->wild[tt]
				: io->tile[TILE_LETTER][t->letter][tt];
			surface_draw(io->screen, s, i * dim.x + rw->pos.x,
				     rw->pos.y);
		}
		break;
	default:
		for (int i = 0; i < RACK_SIZE; i++) {
			t = &p->tile[tm->adjust.data.tile[i].idx];
			if (t->type == TILE_NONE)
				continue;
			s = t->type == TILE_WILD
				? io->wild[tileLookNormal]
				: io->tile[TILE_LETTER][t->letter]
				          [tileLookNormal];
			surface_draw(io->screen, s, i * dim.x + rw->pos.x,
				     rw->pos.y);
		}
		break;
	}
}