1 | -- Returns a new menu sheet |
---|
2 | -- See MenuSheet.new for details about the parameters |
---|
3 | function createMenuSheet(name, bHidePrevious, tShowCursor, tUseKeyboard, bBlockJoyStick) |
---|
4 | local sheet = require("MenuSheet").new(name, bHidePrevious, tShowCursor, tUseKeyboard, bBlockJoyStick) |
---|
5 | global(sheet.name) |
---|
6 | _G[sheet.name] = sheet -- Global access required because of the event handlers |
---|
7 | return sheet |
---|
8 | end |
---|
9 | |
---|
10 | -- Returns a new HUD sheet |
---|
11 | function createHUDSheet(name) |
---|
12 | local sheet = require("HUDSheet").new(name) |
---|
13 | _G[sheet.name] = sheet -- Global access required because of the event handlers |
---|
14 | return sheet |
---|
15 | end |
---|
16 | |
---|
17 | function openDecisionPopup( text, callbackPtr ) |
---|
18 | showMenuSheet("DecisionPopup", false, true) |
---|
19 | DecisionPopup.setCallback(callbackPtr) |
---|
20 | DecisionPopup.setText(text) |
---|
21 | end |
---|
22 | |
---|
23 | function openInfoPopup(text, functionPtr, closeButton, arguments) |
---|
24 | showMenuSheet("InfoPopup", false, true) |
---|
25 | InfoPopup.execute(functionPtr, arguments) |
---|
26 | InfoPopup.setText(text) |
---|
27 | InfoPopup.setCloseButton(closeButton) |
---|
28 | end |
---|
29 | |
---|
30 | function getMinTextSize(window) |
---|
31 | local size = {} |
---|
32 | |
---|
33 | local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel()) |
---|
34 | local height = window:getFont():getLineSpacing() + window:getUnclippedPixelRect():getHeight() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getHeight() |
---|
35 | local width = window:getFont():getTextExtent(window:getText()) + window:getUnclippedPixelRect():getWidth() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getWidth() |
---|
36 | |
---|
37 | table.insert(size, height) |
---|
38 | table.insert(size, width) |
---|
39 | return size |
---|
40 | end |
---|
41 | |
---|
42 | function getScrollingStepSize(window) |
---|
43 | local height = window:getUnclippedPixelRect():getHeight() |
---|
44 | local maxHeight = CEGUI.System:getSingleton():getGUISheet():getUnclippedPixelRect():getHeight() |
---|
45 | local ratio = height/maxHeight |
---|
46 | return 0.008*ratio/0.3204 |
---|
47 | end |
---|