summaryrefslogtreecommitdiff
path: root/src/graphic
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2004-12-26 19:44:58 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2004-12-26 19:44:58 +0000
commit800f8e6070f10908c446147b96d5e1424f55c729 (patch)
treec043d03e5a0294174696a3a6d23ecc12a2acdb80 /src/graphic
parenta94d3a14dd0d891cf05ea0c7a4d1613560fd96c5 (diff)
downloadmana-800f8e6070f10908c446147b96d5e1424f55c729.tar.gz
mana-800f8e6070f10908c446147b96d5e1424f55c729.tar.bz2
mana-800f8e6070f10908c446147b96d5e1424f55c729.tar.xz
mana-800f8e6070f10908c446147b96d5e1424f55c729.zip
Ported the inventory dialog over to Guichan. For the moment it is not
possible to delete or use items.
Diffstat (limited to 'src/graphic')
-rw-r--r--src/graphic/graphic.cpp15
-rw-r--r--src/graphic/graphic.h110
2 files changed, 61 insertions, 64 deletions
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp
index b3173881..02b23181 100644
--- a/src/graphic/graphic.cpp
+++ b/src/graphic/graphic.cpp
@@ -17,8 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * By ElvenProgrammer aka Eugenio Favalli (umperio@users.sourceforge.net)
*/
#include "graphic.h"
@@ -42,13 +40,11 @@ BITMAP *buffer, *chat_background;
DATAFILE *tileset;
char itemCurrenyQ[10] = "0";
-//char page_num;
int map_x, map_y, camera_x, camera_y;
DIALOG_PLAYER *npc_player, *skill_player, *buy_sell_player, *sell_player, *skill_list_player, *npc_list_player;
char npc_text[1000] = "";
char statsString2[255] = "n/a";
char skill_points[10] = "";
-TmwInventory inventory;
Chat chatlog("./docs/chatlog.txt", 20);
int show_npc_dialog = 0;
bool show_skill_dialog = false;
@@ -56,8 +52,10 @@ bool show_skill_list_dialog = false;
char npc_button[10] = "Close";
gcn::TextField *chatInput;
+
StatsDialog *statsDialog;
BuyDialog *buyDialog;
+InventoryDialog *inventoryDialog;
void ChatListener::action(const std::string& eventId)
{
@@ -204,10 +202,12 @@ void init_graphic() {
statsDialog = new StatsDialog(guiTop);
statsDialog->setPosition(SCREEN_W - statsDialog->getWidth() - 10, 10);
- // Create buy dialog
+ // Create buy and inventory dialog
buyDialog = new BuyDialog(guiTop);
+ inventoryDialog = new InventoryDialog(guiTop);
buyDialog->setVisible(false);
-
+ inventoryDialog->setVisible(false);
+ inventoryDialog->setPosition(100, 100);
npc_player = init_dialog(npc_dialog, -1);
position_dialog(npc_dialog, 300, 200);
@@ -216,7 +216,6 @@ void init_graphic() {
sell_player = init_dialog(sell_dialog, -1);
skill_list_player = init_dialog(skill_list_dialog, -1);
npc_list_player = init_dialog(npc_list_dialog, -1);
- inventory.create(100, 100);
vpage[0] = NULL;
vpage[1] = NULL;
@@ -514,7 +513,7 @@ void do_graphic(void) {
guiGraphics->setTarget(vpage[page_num]);
gui_update(NULL);
- inventory.draw(vpage[page_num]);
+ //inventory.draw(vpage[page_num]);
set_trans_blender(0, 0, 0, 110);
draw_trans_sprite(vpage[page_num], chat_background, 0, SCREEN_H - 125);
diff --git a/src/graphic/graphic.h b/src/graphic/graphic.h
index ad1d02fa..d71c5ead 100644
--- a/src/graphic/graphic.h
+++ b/src/graphic/graphic.h
@@ -17,8 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * By ElvenProgrammer aka Eugenio Favalli (umperio@users.sourceforge.net)
*/
#ifndef _GRAPHIC_H
@@ -47,13 +45,13 @@ extern char skill_points[10];
extern Chat chatlog;
extern bool show_skill_dialog, show_skill_list_dialog;
extern int show_npc_dialog;
-extern TmwInventory inventory;
extern int map_x, map_y, camera_x, camera_y;
extern BITMAP *hairset;
extern char npc_button[10];
extern StatsDialog *statsDialog;
extern BuyDialog *buyDialog;
+extern InventoryDialog *inventoryDialog;
// The action listener for the chat field
class ChatListener : public gcn::ActionListener {
@@ -66,68 +64,68 @@ void init_graphic(void);
void exit_graphic(void);
class Surface {
- public:
- BITMAP *buffer;
- virtual void lock() = 0;
- virtual void show() = 0;
- virtual void update() = 0;
+ public:
+ BITMAP *buffer;
+ virtual void lock() = 0;
+ virtual void show() = 0;
+ virtual void update() = 0;
};
class VideoSurface : public Surface {
- private:
- int current_page;
- BITMAP *page[2];
- public:
- VideoSurface(BITMAP *page1, BITMAP *page2) {
- page[0] = page1;
- page[1] = page2;
- current_page = 0;
- }
- ~VideoSurface() {
- destroy_bitmap(page[0]);
- destroy_bitmap(page[2]);
- }
- void lock() {
- acquire_bitmap(buffer);
- }
- void show() {
- release_bitmap(buffer);
- show_video_bitmap(buffer);
- }
- void update() {
- current_page++;
- if (current_page == 2) {
- current_page = 0;
- }
- buffer = page[current_page];
- }
+ private:
+ int current_page;
+ BITMAP *page[2];
+ public:
+ VideoSurface(BITMAP *page1, BITMAP *page2) {
+ page[0] = page1;
+ page[1] = page2;
+ current_page = 0;
+ }
+ ~VideoSurface() {
+ destroy_bitmap(page[0]);
+ destroy_bitmap(page[2]);
+ }
+ void lock() {
+ acquire_bitmap(buffer);
+ }
+ void show() {
+ release_bitmap(buffer);
+ show_video_bitmap(buffer);
+ }
+ void update() {
+ current_page++;
+ if (current_page == 2) {
+ current_page = 0;
+ }
+ buffer = page[current_page];
+ }
};
class MemorySurface : public Surface {
- public:
- MemorySurface(BITMAP *buffer) {
- this->buffer = buffer;
- }
- ~MemorySurface() {
- destroy_bitmap(buffer);
- }
- void lock() {
- }
- void show() {
- blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
- }
- void update() {
- }
+ public:
+ MemorySurface(BITMAP *buffer) {
+ this->buffer = buffer;
+ }
+ ~MemorySurface() {
+ destroy_bitmap(buffer);
+ }
+ void lock() {
+ }
+ void show() {
+ blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
+ }
+ void update() {
+ }
};
class GraphicEngine {
- private:
- Surface *surface;
- Spriteset *tileset;
- public:
- GraphicEngine();
- ~GraphicEngine();
- void refresh();
+ private:
+ Surface *surface;
+ Spriteset *tileset;
+ public:
+ GraphicEngine();
+ ~GraphicEngine();
+ void refresh();
};
#endif