summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorSimon Edwardsson <simon@crossnet.se>2004-10-03 12:56:09 +0000
committerSimon Edwardsson <simon@crossnet.se>2004-10-03 12:56:09 +0000
commit0b00bf2ccff23b5f565e214b36be3ea823ab59da (patch)
tree2b43d9c1e9a72b07c26c2386633d6a80751bd25a /src/gui
parent07af1c32d6d51a4d178ffc4dea7488a949d1e553 (diff)
downloadmana-0b00bf2ccff23b5f565e214b36be3ea823ab59da.tar.gz
mana-0b00bf2ccff23b5f565e214b36be3ea823ab59da.tar.bz2
mana-0b00bf2ccff23b5f565e214b36be3ea823ab59da.tar.xz
mana-0b00bf2ccff23b5f565e214b36be3ea823ab59da.zip
Added tmw_bar_proc, and a stat window, (I have // your stat window kth5 :) )
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui.cpp38
-rw-r--r--src/gui/gui.h7
-rw-r--r--src/gui/inventory.cpp6
3 files changed, 47 insertions, 4 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 10021020..0ca829d9 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -299,7 +299,22 @@ void loadListboxSkin() {
}
}
-
+void loadBarSkin() {
+BITMAP *temp1 = load_bitmap("data/bar.bmp", NULL);
+BITMAP *temp2 = load_bitmap("data/bar_filled.bmp", NULL);
+gui_skin.bar.bg.grid[0] = create_bitmap(3,11);
+gui_skin.bar.bg.grid[1] = create_bitmap(1,11);
+gui_skin.bar.bg.grid[2] = create_bitmap(3,11);
+blit(temp1, gui_skin.bar.bg.grid[0], 0, 0, 0, 0, 3, 11);
+blit(temp1, gui_skin.bar.bg.grid[1], 4, 0, 0, 0, 1, 11);
+blit(temp1, gui_skin.bar.bg.grid[2], 13, 0, 0, 0, 3, 11);
+gui_skin.bar.bg.grid[3] = create_bitmap(3,11);
+gui_skin.bar.bg.grid[4] = create_bitmap(1,11);
+gui_skin.bar.bg.grid[5] = create_bitmap(3,11);
+blit(temp2, gui_skin.bar.bg.grid[3], 0, 0, 0, 0, 3, 11);
+blit(temp2, gui_skin.bar.bg.grid[4], 4, 0, 0, 0, 1, 11);
+blit(temp2, gui_skin.bar.bg.grid[5], 13, 0, 0, 0, 3, 11);
+}
void loadDialogSkin() {
char **tokens;
int tokenCount;
@@ -381,6 +396,7 @@ int gui_load_skin(const char* skinname) {
loadTextboxSkin();
loadListboxSkin();
loadDialogSkin();
+ loadBarSkin();
pop_config_state();
set_mouse_sprite((BITMAP *)gui_gfx[7].dat);
@@ -1021,6 +1037,26 @@ int tmw_list_proc(int msg, DIALOG *d, int c) {
}
return D_O_K;
}
+int tmw_bar_proc(int msg, DIALOG *d, int c)
+{
+float share2 = ((float)d->d1 / (float)d->d2);
+if(share2!=0)
+ masked_blit(gui_skin.bar.bg.grid[3], gui_bitmap, 0, 0, d->x, d->y, gui_bitmap->w, gui_bitmap->h);
+else
+ masked_blit(gui_skin.bar.bg.grid[0], gui_bitmap, 0, 0, d->x, d->y, gui_bitmap->w, gui_bitmap->h);
+
+for(int i = 3; i < (d->w-3); i++)
+ if(i<share2*d->w-3)
+ masked_blit(gui_skin.bar.bg.grid[4], gui_bitmap, 0, 0, d->x+1*i, d->y, gui_bitmap->w, gui_bitmap->h);
+ else
+ masked_blit(gui_skin.bar.bg.grid[1], gui_bitmap, 0, 0, d->x+1*i, d->y, gui_bitmap->w, gui_bitmap->h);
+
+if(share2==1)
+ masked_blit(gui_skin.bar.bg.grid[5], gui_bitmap, 0, 0, d->x+d->w-3, d->y, gui_bitmap->w, gui_bitmap->h);
+else
+ masked_blit(gui_skin.bar.bg.grid[2], gui_bitmap, 0, 0, d->x+d->w-3, d->y, gui_bitmap->w, gui_bitmap->h);
+return D_O_K;
+}
/**
dialog box w/ left centered head
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 47362466..e14a0140 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -80,6 +80,11 @@ typedef struct {
} LexDialog;
typedef struct {
+ LexSkinnedRect bg;
+} LexBar;
+
+
+typedef struct {
LexButton button;
LexSlider slider;
LexCheckbox checkbox;
@@ -87,6 +92,7 @@ typedef struct {
LexTextbox textbox;
LexListbox listbox;
LexDialog dialog;
+ LexBar bar;
} LexSkin;
extern LexSkin gui_skin;
@@ -115,6 +121,7 @@ int tmw_dialog_proc(int msg, DIALOG *d, int c);
int tmw_ldialog_proc(int msg, DIALOG *d, int c);
int tmw_textbox_proc(int msg, DIALOG *d, int c);
int tmw_bitmap_proc(int msg, DIALOG *d, int c);
+int tmw_bar_proc(int msg, DIALOG *d, int c);
void ok(const char *title, const char *message);
unsigned int yes_no(const char *title, const char *message);
diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp
index 09bf56f2..be2b239f 100644
--- a/src/gui/inventory.cpp
+++ b/src/gui/inventory.cpp
@@ -56,10 +56,10 @@ void TmwInventory::draw(BITMAP * buffer) {
for(int i=0;i<INVENTORY_SIZE;i++) {
if(items[i].quantity>0) {
if(items[i].id>=501 && items[i].id<=510)
- masked_blit((BITMAP *)itemset[items[i].id-500].dat, gui_bitmap, 0, 0, inventory_dialog[0].x-90+24*i, inventory_dialog[0].y+26, 22, 22);
+ masked_blit((BITMAP *)itemset[items[i].id-500].dat, gui_bitmap, 0, 0, inventory_dialog[0].x+24*i, inventory_dialog[0].y+26, 22, 22);
else
- masked_blit((BITMAP *)itemset[0].dat, gui_bitmap, 0, 0, inventory_dialog[0].x-90+24*i, inventory_dialog[0].y+26, 22, 22);
- alfont_textprintf_aa(gui_bitmap, gui_font, inventory_dialog[0].x-90+24*i, inventory_dialog[0].y+44, makecol(0,0,0), "%i", items[i].quantity);
+ masked_blit((BITMAP *)itemset[0].dat, gui_bitmap, 0, 0, inventory_dialog[0].x+24*i, inventory_dialog[0].y+26, 22, 22);
+ alfont_textprintf_aa(gui_bitmap, gui_font, inventory_dialog[0].x+24*i, inventory_dialog[0].y+44, makecol(0,0,0), "%i", items[i].quantity);
}
}
}