mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-10-07 21:17:10 -04:00
66 lines
1.7 KiB
C#
66 lines
1.7 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using OpenTK.Input;
|
|
|
|
namespace ClassicalSharp {
|
|
|
|
public abstract class MenuScreen : ClickableScreen {
|
|
|
|
public MenuScreen( Game game ) : base( game ) {
|
|
}
|
|
protected ButtonWidget[] buttons;
|
|
protected Font titleFont, regularFont;
|
|
|
|
protected void RenderMenuBounds() {
|
|
graphicsApi.Draw2DQuad( 0, 0, game.Width, game.Height, new FastColour( 60, 60, 60, 160 ) );
|
|
}
|
|
|
|
protected void RenderMenuButtons( double delta ) {
|
|
for( int i = 0; i < buttons.Length; i++ ) {
|
|
if( buttons[i] == null ) continue;
|
|
buttons[i].Render( delta );
|
|
}
|
|
}
|
|
|
|
public override void Dispose() {
|
|
for( int i = 0; i < buttons.Length; i++ ) {
|
|
if( buttons[i] == null ) continue;
|
|
buttons[i].Dispose();
|
|
}
|
|
titleFont.Dispose();
|
|
if( regularFont != null )
|
|
regularFont.Dispose();
|
|
}
|
|
|
|
public override void OnResize( int oldWidth, int oldHeight, int width, int height ) {
|
|
for( int i = 0; i < buttons.Length; i++ ) {
|
|
if( buttons[i] == null ) continue;
|
|
buttons[i].OnResize( oldWidth, oldHeight, width, height );
|
|
}
|
|
}
|
|
|
|
public override bool HandlesAllInput {
|
|
get { return true; }
|
|
}
|
|
|
|
public override bool HandlesMouseClick( int mouseX, int mouseY, MouseButton button ) {
|
|
return HandleMouseClick( buttons, mouseX, mouseY, button );
|
|
}
|
|
|
|
public override bool HandlesMouseMove( int mouseX, int mouseY ) {
|
|
return HandleMouseMove( buttons, mouseX, mouseY );
|
|
}
|
|
|
|
public override bool HandlesKeyPress( char key ) {
|
|
return true;
|
|
}
|
|
|
|
public override bool HandlesKeyDown( Key key ) {
|
|
return true;
|
|
}
|
|
|
|
public override bool HandlesKeyUp( Key key ) {
|
|
return true;
|
|
}
|
|
}
|
|
} |