Atrinik Client  4.0
texture.c
Go to the documentation of this file.
1 /*************************************************************************
2  * Atrinik, a Multiplayer Online Role Playing Game *
3  * *
4  * Copyright (C) 2009-2014 Alex Tokar and Atrinik Development Team *
5  * *
6  * Fork from Crossfire (Multiplayer game for X-windows). *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the Free Software *
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
21  * *
22  * The author can be reached at admin@atrinik.org *
23  ************************************************************************/
24 
33 #include <global.h>
34 
36 static void widget_draw(widgetdata *widget)
37 {
38  _widget_texture *texture;
39 
40  texture = widget->subwidget;
41 
42  if (texture->texture) {
43  surface_show(ScreenSurface, widget->x, widget->y, NULL, texture_surface(texture->texture));
44  }
45 }
46 
51 {
52  _widget_texture *texture;
53 
54  texture = ecalloc(1, sizeof(*texture));
55 
56  widget->draw_func = widget_draw;
57  widget->subwidget = texture;
58 }
void * subwidget
Definition: widget.h:107
SDL_Surface * texture_surface(texture_struct *texture)
Definition: texture.c:303
void widget_texture_init(widgetdata *widget)
Definition: texture.c:50
SDL_Surface * ScreenSurface
Definition: main.c:47
static void widget_draw(widgetdata *widget)
Definition: texture.c:36
int x
Definition: widget.h:48
void surface_show(SDL_Surface *surface, int x, int y, SDL_Rect *srcrect, SDL_Surface *src)
Definition: sprite.c:761
texture_struct * texture
Definition: widget.h:221
int y
Definition: widget.h:51