| [6746] | 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) |
|---|
| [6773] | 5 | global(sheet.name) |
|---|
| [6746] | 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 | |
|---|
| [6145] | 17 | function openDecisionPopup( text, callbackPtr ) |
|---|
| [6746] | 18 | showMenuSheet("DecisionPopup", false, true) |
|---|
| [6266] | 19 | DecisionPopup.setCallback(callbackPtr) |
|---|
| [6145] | 20 | DecisionPopup.setText(text) |
|---|
| [6266] | 21 | end |
|---|
| 22 | |
|---|
| [6311] | 23 | function openInfoPopup(text, functionPtr, closeButton, arguments) |
|---|
| [6746] | 24 | showMenuSheet("InfoPopup", false, true) |
|---|
| [6311] | 25 | InfoPopup.execute(functionPtr, arguments) |
|---|
| [6266] | 26 | InfoPopup.setText(text) |
|---|
| [6283] | 27 | InfoPopup.setCloseButton(closeButton) |
|---|
| [6266] | 28 | end |
|---|
| [6355] | 29 | |
|---|
| 30 | function getMinTextSize(window) |
|---|
| 31 | local size = {} |
|---|
| [6387] | 32 | |
|---|
| [6355] | 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() |
|---|
| [6387] | 36 | |
|---|
| [6355] | 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 |
|---|