https://github.com/icculusc/kspplugintaskbar
https://github.com/icculusc/kspplugintaskbar
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/icculusc/kspplugintaskbar
- Owner: IcculusC
- Created: 2012-12-23T06:06:33.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2012-12-28T09:44:15.000Z (over 13 years ago)
- Last Synced: 2025-01-20T20:56:47.561Z (over 1 year ago)
- Language: C#
- Size: 145 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.txt
Awesome Lists containing this project
README
// Usage instructions:
// Include the API(PluginTaskbar.cs) in your project.
// Create a 30x30 icon or set of 30x30 icons
// Load your icon/icons as Texture2D or the relevant Texture subclass
// use the PluginTaskbar namespace
using PluginTaskbar;
// implement the interface ITaskbarModule
ExampleClass : Part, ITaskbarModule
// define the functions of the interface
public Texture TaskbarIcon()
{
return yourIcon;
}
public void TaskbarClicked(bool leftClick)
{
if(leftClick)
Debug.Log("LEFT CLICKED!");
else
Debug.Log("RIGHT CLICKED!");
}
// return null if you don't want a tooltip
public string TaskbarTooltip()
{
return yourTooltipText;
}
public void TaskbarHover(Vector3 mousePosition)
{
// do something on hover if you'd like
return;
}
// place any draw calls here, these will be invoked after the taskbar is drawn
public void TaskbarDraw(Rect buttonRect, bool visible)
{
// MUST HAVE RETURN STATEMENT
return;
}
// define a few things
// the key for your module, this needs to be unique per toolbar icon
private static string yourModuleName = "yourModuleName";
// the hook class, you must define one of these for each icon
private TaskbarHooker taskbarHook;
// create an instance of the TaskbarHooker, use this because your class implements
// the interface ITaskbarModule
taskbarHook = new TaskbarHooker(this, yourModuleName);
// start the hook when your part loads, this returns a boolean so if you have a
// secondary icon or display method you can use it instead
// returns true if taskbar is installed and successfully hooked
taskbarHook.Start();
// stop the hook when the part dies, very important, this also returns a boolean
// so you can handle things alternatively if it fails
// returns true if taskbar is installed and successfully unhooked
taskbarHook.Stop();