Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 2, 2011, 1:58:12 PM (14 years ago)
Author:
dafrick
Message:

Notification text alignment can be set per queue.

Location:
code/branches/tutoriallevel2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/tutoriallevel2/data/gui/scripts/NotificationLayer.lua

    r8377 r8378  
    3232        ["fontSize"]  = 12,
    3333        ["fontColor"] = "FFFFFFFF",
     34        ["alignment"] = "LeftAligned",
    3435        ["items"]     = {},
    3536        ["first"]     = 1,
     
    7980    item:setProperty("BackgroundEnabled", "false")
    8081    item:setProperty("FrameEnabled", "false")
     82    item:setProperty("HorzFormatting", queue.alignment)
    8183    queue.items[queue.last] = item
    8284    queue.last = queue.last+1
     
    215217end
    216218
     219function P.changeQueueAlignment(queueName, alignment)
     220    local queue = P.queueList[queueName]
     221    local queueWindow = queue.window
     222    if queueWindow == nil then
     223        return
     224    end
     225   
     226    queue.alignment = alignment
     227    local item = nil
     228    for i=queue.first,queue.last-1 do
     229        item = queue.items[i]
     230        item:setProperty("HorzFormatting", queue.alignment)
     231    end
     232end
     233
    217234-- Helper function to set the font size and color of a item of a queue.
    218235-- The parameters are (in order) 'the ListboxItem', 'the queue table', 'whether color should be changed as well'
     
    228245    if changeColor then
    229246        item:setProperty("TextColours", "tl:" .. queue.fontColor .. " tr:" .. queue.fontColor .. " bl:" .. queue.fontColor .. " br:" .. queue.fontColor .. "")
    230         cout(0, "tl:[" .. queue.fontColor .. "] tr:[" .. queue.fontColor .. "] bl:[" .. queue.fontColor .. "] br:[" .. queue.fontColor .. "]")
    231247    end
    232248end
  • code/branches/tutoriallevel2/src/modules/notifications/NotificationManager.cc

    r8374 r8378  
    367367        GUIManager::getInstance().getLuaState()->doString("NotificationLayer.resizeQueue(\"info\", 0.6, 0, " + multi_cast<std::string>(infoQueue->getMaxSize()) + ")");
    368368        GUIManager::getInstance().getLuaState()->doString("NotificationLayer.moveQueue(\"info\", 0.2, 0, 0.8, 0)");
     369        GUIManager::getInstance().getLuaState()->doString("NotificationLayer.changeQueueAlignment(\"info\", \"HorzCentred\")");
    369370    }
    370371
  • code/branches/tutoriallevel2/src/orxonox/interfaces/NotificationListener.h

    r8377 r8378  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Damian 'Mozork' Frick
    2424 *   Co-authors:
    2525 *      ...
     
    6666    }
    6767
     68    // TODO: Update doc.
    6869    /**
    6970    @brief
     
    7475
    7576    @author
    76         Fabian 'x3n' Landau
    77 
     77        Damian 'Mozork' Frick
     78       
    7879    @ingroup Notifications
    7980    */
     
    9091            static void sendNotificationHelper(const std::string& message, const std::string& sender, unsigned int messageMode);
    9192           
    92             virtual bool registerNotification(const std::string& message, const std::string& sender)
    93                 { return false; }
     93            virtual bool registerNotification(const std::string& message, const std::string& sender) { return false; }
    9494            virtual void executeCommand(const std::string& command, const std::string& sender) {}
    9595    };
Note: See TracChangeset for help on using the changeset viewer.