Closed Schaapie-D2 closed 3 months ago
Cosmos is really funky with static stuff from my past experience, you should make the variables static but have like an Init() void that initializes them and call that void from BeforeRun()
I did that but it still gives that exception. It now gives it when the Init() method gets called. Maybe it doesn't like to interact with the variables?
Fixed it! code:
using Cosmos.System.Graphics.Fonts;
using System.Drawing;
namespace HontelOS.GUI
{
public class Style
{
#region General
public Color PrimaryColor;
public Color SecondaryColor;
public Color TritraryColor;
public Font SystemFont;
#endregion
#region System
public Color Dock_BackgroundColor;
public Color TopBar_BackgroundColor;
#endregion
#region GUI
public Color Window_BackgroundColor;
public Color Window_HandleColor;
public Color Window_HandleButtonGlowColor;
public Color Button_NormalColor;
public Color Button_HoverColor;
public Color Button_PressedColor;
public Color Button_DisabledColor;
public Color ContextMenu_BackgroundColor;
public Color ContextMenu_HoverColor;
#endregion
public Style()
{
PrimaryColor = Color.FromArgb(60, 60, 255);
SecondaryColor = Color.FromArgb(60, 100, 255);
TritraryColor = Color.FromArgb(60, 40, 255);
SystemFont = PCScreenFont.Default;
Dock_BackgroundColor = Color.FromArgb(194, 194, 194);
TopBar_BackgroundColor = Color.FromArgb(194, 194, 194);
Window_BackgroundColor = Color.White;
Window_HandleColor = Color.FromArgb(243, 243, 243);
Window_HandleButtonGlowColor = Color.LightGray;
Button_NormalColor = Color.FromArgb(60, 60, 255);
Button_HoverColor = Color.FromArgb(60, 100, 255);
Button_PressedColor = Color.FromArgb(60, 40, 255);
Button_DisabledColor = Color.Gray;
ContextMenu_BackgroundColor = Color.FromArgb(240, 240, 240);
ContextMenu_HoverColor = Color.FromArgb(180, 180, 180);
}
}
}
Kernel: add
public static Style style;
protected override void BeforeRun()
{
style = new Style();
}
Area of Cosmos - What area of Cosmos are we dealing with?
Code ¯_ (ツ)_/¯
Expected Behaviour - What do you think that should happen?
Get the specified color from a class
Actual Behaviour - What unexpectedly happens?
OS crashes and gives a NullReferenceException
Reproduction - How did you get this error to appear?
the colors:
example of it being used:
Version - Were you using the User Kit or Dev Kit? And what User Kit version or Dev Kit commit (Cosmos, IL2CPU, X#)?
Devkit