Bearsampp 2026.3.26
API documentation
Loading...
Searching...
No Matches
Splash Class Reference

Public Member Functions

 __construct ()
 getWbWindow ()
 incrProgressBar ($nb=1)
 init ($title, $gauge, $text)
 setTextLoading ($caption)

Data Fields

const WINDOW_HEIGHT = 90
const WINDOW_WIDTH = 460

Private Attributes

 $currentImg
 $wbImage
 $wbProgressBar
 $wbTextLoading
 $wbWindow

Detailed Description

Class Splash

This class represents a splash screen with a progress bar for the Bearsampp application. It provides methods to initialize the splash screen, set loading text, and increment the progress bar.

Definition at line 16 of file class.splash.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Splash constructor.

Initializes the Splash class and sets the current image to null.

Definition at line 34 of file class.splash.php.

35 {
36 Util::logInitClass($this);
37 $this->currentImg = null;
38 }
static logInitClass($classInstance)

References Util\logInitClass().

Member Function Documentation

◆ getWbWindow()

getWbWindow ( )

Retrieves the window object of the splash screen.

Returns
mixed The window object of the splash screen.

Definition at line 114 of file class.splash.php.

115 {
116 return $this->wbWindow;
117 }

References $wbWindow.

◆ incrProgressBar()

incrProgressBar ( $nb = 1)

Increments the progress bar by a specified number of steps.

Parameters
int$nbThe number of steps to increment the progress bar by. Default is 1.

Definition at line 96 of file class.splash.php.

97 {
98 global $bearsamppCore, $bearsamppWinbinder;
99
100 for ($i = 0; $i < $nb; $i++) {
101 $bearsamppWinbinder->drawImage($this->wbWindow, $bearsamppCore->getImagesPath() . '/bearsampp.bmp', 4, 4, 32, 32);
102 $bearsamppWinbinder->incrProgressBar($this->wbProgressBar);
103 }
104
105 $bearsamppWinbinder->wait();
106 $bearsamppWinbinder->wait($this->wbWindow);
107 }
global $bearsamppCore

References $bearsamppCore.

Referenced by init().

◆ init()

init ( $title,
$gauge,
$text )

Initializes the splash screen.

Parameters
string$titleThe title of the splash screen window.
int$gaugeThe maximum value for the progress bar.
string$textThe initial loading text to display.

Definition at line 47 of file class.splash.php.

48 {
49 global $bearsamppCore, $bearsamppWinbinder;
50
51 $bearsamppWinbinder->reset();
52
53 $screenArea = explode(' ', $bearsamppWinbinder->getSystemInfo(WinBinder::SYSINFO_WORKAREA));
54 $screenWidth = intval($screenArea[2]);
55 $screenHeight = intval($screenArea[3]);
56 $xPos = $screenWidth - self::WINDOW_WIDTH;
57 $yPos = $screenHeight - self::WINDOW_HEIGHT - 5;
58
59 $this->wbWindow = $bearsamppWinbinder->createWindow(null, ToolDialog, $title, $xPos, $yPos, self::WINDOW_WIDTH, self::WINDOW_HEIGHT, WBC_TOP | WBC_READONLY, null);
60
61 // Check if window was created successfully
62 if ($this->wbWindow === false || $this->wbWindow === null) {
63 Util::logError('Failed to create splash window');
64 return;
65 }
66
67 // CRITICAL: wb_set_visible() must be called AFTER window creation in PHP 8.4
68 // The WS_VISIBLE flag during creation doesn't work
69 wb_set_visible($this->wbWindow, true);
70
71 $this->wbImage = $bearsamppWinbinder->drawImage($this->wbWindow, $bearsamppCore->getImagesPath() . '/bearsampp.bmp');
72 $this->wbProgressBar = $bearsamppWinbinder->createProgressBar($this->wbWindow, $gauge + 1, 42, 24, 390, 15);
73
74 $this->setTextLoading($text);
75 $this->incrProgressBar();
76 }
setTextLoading($caption)
incrProgressBar($nb=1)
static logError($data, $file=null)
const SYSINFO_WORKAREA

References $bearsamppCore, incrProgressBar(), Util\logError(), setTextLoading(), and WinBinder\SYSINFO_WORKAREA.

◆ setTextLoading()

setTextLoading ( $caption)

Sets the loading text on the splash screen.

Parameters
string$captionThe loading text to display.

Definition at line 83 of file class.splash.php.

84 {
85 global $bearsamppWinbinder;
86
87 $bearsamppWinbinder->drawRect($this->wbWindow, 42, 0, self::WINDOW_WIDTH - 42, self::WINDOW_HEIGHT);
88 $this->wbTextLoading = $bearsamppWinbinder->drawText($this->wbWindow, $caption, 42, 0, self::WINDOW_WIDTH - 44, 25);
89 }

Referenced by init().

Field Documentation

◆ $currentImg

$currentImg
private

Definition at line 27 of file class.splash.php.

◆ $wbImage

$wbImage
private

Definition at line 23 of file class.splash.php.

◆ $wbProgressBar

$wbProgressBar
private

Definition at line 25 of file class.splash.php.

◆ $wbTextLoading

$wbTextLoading
private

Definition at line 24 of file class.splash.php.

◆ $wbWindow

$wbWindow
private

Definition at line 22 of file class.splash.php.

Referenced by getWbWindow().

◆ WINDOW_HEIGHT

const WINDOW_HEIGHT = 90

Definition at line 20 of file class.splash.php.

◆ WINDOW_WIDTH

const WINDOW_WIDTH = 460

Definition at line 19 of file class.splash.php.


The documentation for this class was generated from the following file: