Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyHandler : StaticEventHandler
- {
- bool InLevel;
- override void OnRegister()
- {
- InLevel = false;
- }
- override void WorldLoaded(WorldEvent e)
- {
- InLevel = true;
- }
- override void WorldUnloaded(WorldEvent e)
- {
- InLevel = false;
- }
- override void WorldTick(WorldEvent e)
- {
- //Console.Printf("MyHandler - world tick");
- }
- private int VirtualWidth;
- private int VirtualHeight;
- private Font SMALLFNT;
- private Font BIGFONT;
- private void DrawText(Font font, string text, double x, double y, int color) // align right!
- {
- int wd = font.StringWidth(text);
- Screen.DrawText(font, color, x-wd, y, text, DTA_Alpha, 1.0, DTA_VirtualWidth, VirtualWidth, DTA_VirtualHeight, VirtualHeight, DTA_KeepRatio, true, 0);
- }
- override void RenderOverlay(RenderEvent e)
- {
- if (!InLevel)
- return;
- VirtualWidth = Screen.GetWidth()/3;
- VirtualHeight = Screen.GetHeight()/3;
- SMALLFNT = Font.GetFont("SMALLFONT");
- BIGFONT = Font.GetFont("BIGFONT");
- //Screen.DrawText(f, Screen.CR_RED, vw/2-wd/2, 16, "Totally meow here", DTA_Alpha, (sin(level.time*8)/2)+0.5, DTA_VirtualWidth, vw, DTA_VirtualHeight, vh, 0);
- DrawText(SMALLFNT, "Current map is:", VirtualWidth-8, 8, Screen.CR_RED);
- DrawText(BIGFONT, String.Format("%s - %s", level.MapName, level.LevelName), VirtualWidth-8, 16, Screen.CR_GOLD);
- VirtualWidth = Screen.GetWidth();
- VirtualHeight = Screen.GetHeight();
- //DrawText(SMALLFNT, "(overlay message powered by bleeding edge ZScript event system)", VirtualWidth-32, 96, Screen.CR_DARKRED);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement