mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-18 14:23:56 -07:00
Tested By: Langbart Differential Revision: https://code.wildfiregames.com/D4311 This was SVN commit r25992.
35 lines
664 B
JavaScript
35 lines
664 B
JavaScript
/**
|
|
* Base class for all controls on the developer overlay.
|
|
*/
|
|
class DeveloperOverlayControl
|
|
{
|
|
constructor(handler, i)
|
|
{
|
|
this.handler = handler;
|
|
this.handler.update = () => this.update();
|
|
|
|
this.body = Engine.GetGUIObjectByName("dev_command[" + i + "]");
|
|
this.resize(i);
|
|
|
|
this.updater = this.update.bind(this);
|
|
|
|
if (this.handler.checked)
|
|
registerPlayersInitHandler(this.updater);
|
|
}
|
|
|
|
getHeight()
|
|
{
|
|
return this.body.size.bottom - this.body.size.top;
|
|
}
|
|
|
|
resize(i)
|
|
{
|
|
let size = this.body.size;
|
|
let height = size.bottom;
|
|
size.top = height * i;
|
|
size.bottom = height * (i + 1);
|
|
this.body.size = size;
|
|
this.body.hidden = false;
|
|
}
|
|
}
|
|
|