summaryrefslogtreecommitdiff
path: root/src/widget_button.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-28 16:38:35 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-28 16:38:35 +0000
commit2d776fcd61be168e1ff0ff2e4a5e71835e7cea19 (patch)
tree7cf274897bf540d5332d446f583ffd066e4e2e1d /src/widget_button.c
parentb877ae23ac5d380ab3aa48d7724045cf4883b186 (diff)
- prekopanie adresarovej struktury, prva cast
git-svn-id: http://opensvn.csie.org/tuxanci_ng@77 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/widget_button.c')
-rw-r--r--src/widget_button.c82
1 files changed, 0 insertions, 82 deletions
diff --git a/src/widget_button.c b/src/widget_button.c
deleted file mode 100644
index 2638619..0000000
--- a/src/widget_button.c
+++ /dev/null
@@ -1,82 +0,0 @@
-
-#include <stdlib.h>
-
-#include "main.h"
-#include "interface.h"
-#include "font.h"
-#include "widget_button.h"
-#include "image.h"
-
-widget_button_t* newWidgetButton(char *text, int x, int y, void (*fce_event)(void *))
-{
- widget_button_t *new;
-
- new = malloc( sizeof(widget_button_t) );
- new->text = strdup(text);
- new->x = x;
- new->y = y;
- new->fce_event = fce_event;
- getTextSize(text, &new->w, &new->h);
-
- return new;
-}
-
-void drawWidgetButton(widget_button_t *p)
-{
- static SDL_Surface *g_button0 = NULL;
- static SDL_Surface *g_button1 = NULL;
- int x, y;
-
- getMousePosition(&x, &y);
-
- if( g_button0 == NULL )
- {
- g_button0 = addImageData("button0.png", IMAGE_ALPHA, "button0", IMAGE_GROUP_BASE);
- }
-
- if( g_button1 == NULL )
- {
- g_button1 = addImageData("button1.png", IMAGE_ALPHA, "button1", IMAGE_GROUP_BASE);
- }
-
- if( x >= p->x && x <= p->x+WIDGET_BUTTON_WIDTH &&
- y >= p->y && y <= p->y+WIDGET_BUTTON_HEIGHT )
- {
- drawImage(g_button1, p->x, p->y, 0, 0, g_button0->w, g_button0->h);
- }
- else
- {
- drawImage(g_button0, p->x, p->y, 0, 0, g_button0->w, g_button0->h);
- }
-
- //drawFont(p->text, p->x+WIDGET_BUTTON_WIDTH/2-p->w/2, p->y+p->h/2, COLOR_WHITE);
- drawFont(p->text, p->x + WIDGET_BUTTON_WIDTH/2 - p->w/2, p->y + WIDGET_BUTTON_HEIGHT/2 - p->h/2, COLOR_WHITE);
-}
-
-void eventWidgetButton(widget_button_t *p)
-{
- static int time = 0;
- int x, y;
-
- if( time > 0)
- {
- time--;
- return;
- }
-
- getMousePosition(&x, &y);
-
- if( x >= p->x && x <= p->x+WIDGET_BUTTON_WIDTH &&
- y >= p->y && y <= p->y+WIDGET_BUTTON_HEIGHT &&
- isMouseClicked() )
- {
- time = WIDGET_BUTTON_TIME;
- p->fce_event(p);
- }
-}
-
-void destroyWidgetButton(widget_button_t *p)
-{
- free(p->text);
- free(p);
-}