From 69dbc046eb5a82b38c6d5c3302e9b3b0b3c1bcf1 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 21 Feb 2011 16:10:36 +0200 Subject: preliminary lua scripting framework for objects --- src/main.cpp | 132 ----------------------------------------------------------- 1 file changed, 132 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index f0bc6d7a2..06fae74bf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1186,138 +1186,6 @@ void updateViewingRange(f32 frametime_in, Client *client) frametime_old = frametime; } -#if 0 -// TODO: Remove -class GUIQuickInventory -{ -public: - GUIQuickInventory( - gui::IGUIEnvironment* env, - gui::IGUIElement* parent, - v2s32 pos, - s32 itemcount, - Inventory *inventory): - m_itemcount(itemcount), - m_inventory(inventory) - { - core::rect imgsize(0,0,quickinv_size,quickinv_size); - core::rect textsize(0,0,quickinv_size,quickinv_size); - bgtext = env->addStaticText(L"", core::rect(0,0,1,1), false, false); - bgtext->setBackgroundColor( - video::SColor(128,0,0,0)); - for(s32 i=0; iaddImage( - imgsize - )); - m_images[i]->setScaleImage(true); - m_texts.push_back(env->addStaticText( - L"", - textsize, - false, false - )); - /*m_texts[i]->setBackgroundColor( - video::SColor(128,0,0,0));*/ - m_texts[i]->setTextAlignment( - gui::EGUIA_LOWERRIGHT, - gui::EGUIA_LOWERRIGHT); - } - - updatePosition(pos); - } - - ~GUIQuickInventory() - { - for(u32 i=0; iremove(); - } - for(u32 i=0; iremove(); - } - bgtext->remove(); - } - - void updatePosition(v2s32 pos) - { - v2s32 spacing(quickinv_spacing, 0); - for(s32 i=0; isetRelativePosition(pos + spacing*i); - m_texts[i]->setRelativePosition(pos + spacing*i); - } - core::rect bgrect(-quickinv_outer_padding,-quickinv_outer_padding, - (quickinv_itemcount-1)*quickinv_spacing+quickinv_size+quickinv_outer_padding, - quickinv_size+quickinv_outer_padding); - bgtext->setRelativePosition(bgrect+pos); - } - - void setSelection(s32 i) - { - m_selection = i; - } - - void update() - { - s32 start = 0; - - //start = m_selection - m_itemcount / 2; - - InventoryList *mainlist = m_inventory->getList("main"); - - for(s32 i=0; i (s32)mainlist->getSize() - 1) - j -= mainlist->getSize(); - if(j < 0) - j += mainlist->getSize(); - - InventoryItem *item = mainlist->getItem(j); - // Null items - if(item == NULL) - { - m_images[i]->setImage(NULL); - - if(m_selection == j) - m_texts[i]->setText(L"->"); - else - m_texts[i]->setText(L""); - - // The next ifs will segfault with a NULL pointer - continue; - } - - - m_images[i]->setImage(item->getImage()); - - std::ostringstream os; - if(m_selection == j) - os<<"-> "; - os<getText(); - m_texts[i]->setText(narrow_to_wide(os.str()).c_str()); - - /*wchar_t t[10]; - if(m_selection == j) - swprintf(t, 10, SWPRINTF_CHARSTRING L" <-", item->getText().c_str()); - else - swprintf(t, 10, SWPRINTF_CHARSTRING, item->getText().c_str()); - m_texts[i]->setText(t);*/ - } - } - -private: - s32 m_itemcount; - gui::IGUIStaticText *bgtext; - core::array m_texts; - core::array m_images; - Inventory *m_inventory; - s32 m_selection; -}; -#endif - void draw_hotbar(video::IVideoDriver *driver, gui::IGUIFont *font, v2s32 centerlowerpos, s32 imgsize, s32 itemcount, Inventory *inventory) -- cgit v1.2.3