public abstract class BaseExtension
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
authorName
Deprecated.
|
protected int |
category |
protected java.lang.String |
classname
Deprecated.
|
protected java.lang.String |
description
Deprecated.
|
protected java.lang.String |
gameCenterName
The name of this extension in the Dashboard sidebar menu.
|
protected javax.swing.Icon |
icon
Deprecated.
|
protected int |
ID |
protected int |
internalVersion
Deprecated.
|
protected boolean |
isActive |
protected boolean |
isInGameCenter
Whether this extension is included in the Dashboard sidebar menu
|
protected boolean |
isInMenu
Whether this extension is included in the menu bar's "Extensions" menu
|
protected boolean |
isMenuItemInitiallyEnabled
Whether this extension is initially enabled in the Extensions menu.
|
protected java.lang.String |
menuName
The name of this extension in the Extensions menu.
|
protected java.lang.String |
name
Deprecated.
|
protected java.util.HashMap<java.lang.String,java.lang.Object> |
properties |
protected java.lang.String |
version
Deprecated.
|
protected java.lang.String |
website
Deprecated.
|
Constructor and Description |
---|
BaseExtension() |
Modifier and Type | Method and Description |
---|---|
void |
disableMenu() |
static void |
doLongTask(java.lang.Runnable mainTask,
java.lang.Runnable onFinish)
Do a background task that could hold up the program.
|
void |
enableMenu() |
void |
extensionsReady()
Deprecated.
|
java.lang.String |
getAuthorName()
Deprecated.
|
int |
getCategory() |
java.lang.String |
getClassname()
Deprecated.
|
java.lang.String |
getDescription()
Deprecated.
|
stencyl.sw.editors.snippet.designer.Definitions.DefinitionMap |
getDesignModeBlocks()
A set of Design Mode blocks provided by this extension.
|
java.lang.String |
getGameCenterName() |
javax.swing.Icon |
getIcon()
Deprecated.
|
int |
getID() |
java.lang.Integer |
getImageSaveRequest()
Override this function to skip the Save File dialog for screenshots (scene and behavior/event screen captures)
|
int |
getInternalVersion()
Deprecated.
|
stencyl.sw.ext.ExtensionManifest |
getManifest() |
java.lang.String |
getMenuName() |
java.lang.String |
getName()
Deprecated.
|
java.lang.String |
getVersion()
Deprecated.
|
java.lang.String |
getWebsite()
Deprecated.
|
boolean |
handlesImages(boolean requiresSameSize)
Return true if you want this extension to be included
in a list of processors that operate on images.
|
boolean |
handlesSounds()
Return true if you want this extension to be included
in a list of processors that operate on sounds.
|
protected boolean |
hasOptions() |
protected void |
hideProgressSpinner()
Hide the progress spinner.
|
boolean |
isActive()
Deprecated.
|
boolean |
isInGameCenter() |
boolean |
isInMenu() |
boolean |
isKitSpecific()
A kit can bundle an extension (placed at [KIT_DIR]/extensions/)
|
boolean |
isMenuItemInitiallyEnabled() |
abstract void |
onActivate()
Happens when the extension is told to display.
|
void |
onDestroy()
Happens when Stencyl closes.
|
void |
onGameBuild(stencyl.core.lib.Game game)
Happens when the user runs, previews or exports the game.
|
javax.swing.JPanel |
onGameCenterActivate()
Return a UI to show if/when this extension is shown
in the Game Center.
|
void |
onGameClosed(stencyl.core.lib.Game game)
Happens when a game is closed.
|
void |
onGameCreatedFromKit()
Called when a game is created from a kit.
|
abstract void |
onGameOpened(stencyl.core.lib.Game game)
Happens when a game is opened.
|
abstract void |
onGameSave(stencyl.core.lib.Game game)
Happens when a game is saved.
|
abstract void |
onInstall()
Happens when the extension is first installed.
|
abstract OptionsPanel |
onOptions()
Show the options dialog for this extension.
|
void |
onScreenCapture(java.awt.image.BufferedImage img)
NJM new callback
Happens when a screen capture is triggered.
|
void |
onStartup()
Happens when Stencyl launches.
|
abstract void |
onUninstall()
Happens when the extension is uninstalled.
|
java.awt.image.BufferedImage |
processImage(java.awt.image.BufferedImage in)
Given an image, process it and send back the final result.
|
byte[] |
processSound(byte[] in,
java.lang.String format)
Given a sound, process it and send back the final result.
|
protected void |
putProp(java.lang.String key,
java.lang.Object value)
Store a property.
|
protected boolean |
readBoolProp(java.lang.String key,
boolean defaultValue)
Read a boolean property.
|
protected java.lang.String |
readData()
Read your extension's data in to a String.
|
protected byte[] |
readDataAsBytes()
Read your extension's data in to a byte array.
|
protected double |
readDoubleProp(java.lang.String key,
double defaultValue)
Read a double property.
|
protected float |
readFloatProp(java.lang.String key,
float defaultValue)
Read a float property.
|
protected int |
readIntProp(java.lang.String key,
int defaultValue)
Read an integer property.
|
protected java.lang.String |
readStringProp(java.lang.String key,
java.lang.String defaultValue)
Read a string property.
|
protected boolean |
saveData(java.lang.String data)
Save your extension's data given a String representation of it.
|
protected boolean |
saveDataAsBytes(byte[] b)
Save your extension's data given a byte array representation of it.
|
void |
setActive(boolean isActive)
Deprecated.
|
void |
setAuthorName(java.lang.String authorName)
Deprecated.
|
void |
setCategory(int category) |
void |
setDescription(java.lang.String description)
Deprecated.
|
void |
setGameCenterCount(int count) |
void |
setGameCenterItem(com.explodingpixels.macwidgets.SourceListItem item) |
void |
setGameCenterName(java.lang.String gameCenterName) |
void |
setID(int id) |
void |
setInGameCenter(boolean isInGameCenter) |
void |
setInMenu(boolean isInMenu) |
void |
setInternalVersion(int internalVersion)
Deprecated.
|
void |
setManifest(stencyl.sw.ext.ExtensionManifest manifest) |
void |
setMenuItem(javax.swing.JMenuItem item) |
void |
setMenuName(java.lang.String menuName) |
void |
setMenuText(java.lang.String t) |
void |
setName(java.lang.String name)
Deprecated.
|
protected void |
setProgressMessage(java.lang.String msg)
Show a progress spinner with a message.
|
void |
setVersion(java.lang.String version)
Deprecated.
|
void |
setWebsite(java.lang.String website)
Deprecated.
|
void |
showInGameCenter() |
protected void |
showMessageDialog(java.lang.String title,
java.lang.String text)
Show a simple modal dialog to the user.
|
protected void |
showOptions() |
protected void |
showProgressSpinner()
Show a progress spinner with no message.
|
java.lang.String |
toString() |
@Deprecated protected java.lang.String classname
protected int ID
@Deprecated protected java.lang.String name
@Deprecated protected java.lang.String description
@Deprecated protected java.lang.String authorName
@Deprecated protected java.lang.String website
@Deprecated protected int internalVersion
@Deprecated protected java.lang.String version
protected int category
protected boolean isActive
@Deprecated protected javax.swing.Icon icon
protected boolean isInMenu
protected boolean isMenuItemInitiallyEnabled
enableMenu
and disableMenu
to change this later.protected java.lang.String menuName
setMenuText
to set this later.protected boolean isInGameCenter
protected java.lang.String gameCenterName
setGameCenterName
to set this later.protected java.util.HashMap<java.lang.String,java.lang.Object> properties
protected int readIntProp(java.lang.String key, int defaultValue)
key
- Property namedefaultValue
- Default value if the property doesn't existdefaultValue
protected double readDoubleProp(java.lang.String key, double defaultValue)
key
- Property namedefaultValue
- Default value if the property doesn't existdefaultValue
protected float readFloatProp(java.lang.String key, float defaultValue)
key
- Property namedefaultValue
- Default value if the property doesn't existdefaultValue
protected boolean readBoolProp(java.lang.String key, boolean defaultValue)
key
- Property namedefaultValue
- Default value if the property doesn't existdefaultValue
protected java.lang.String readStringProp(java.lang.String key, java.lang.String defaultValue)
key
- Property namedefaultValue
- Default value if the property doesn't existdefaultValue
protected void putProp(java.lang.String key, java.lang.Object value)
key
- Property namevalue
- The value to store.protected final void showMessageDialog(java.lang.String title, java.lang.String text)
title
- Title of the messagetext
- Content of the messagepublic static final void doLongTask(java.lang.Runnable mainTask, java.lang.Runnable onFinish)
mainTask
- task to run in the backgroundonFinish
- task to run when mainTask
is completeprotected final void setProgressMessage(java.lang.String msg)
msg
- Message to showprotected final void showProgressSpinner()
protected final void hideProgressSpinner()
protected final java.lang.String readData()
protected final byte[] readDataAsBytes()
protected final boolean saveData(java.lang.String data)
data
- The data to saveprotected final boolean saveDataAsBytes(byte[] b)
b
- The data to savepublic boolean handlesImages(boolean requiresSameSize)
requiresSameSize
- informs you whether the image has to retain its sizepublic java.awt.image.BufferedImage processImage(java.awt.image.BufferedImage in)
in
- the input imagepublic boolean handlesSounds()
public byte[] processSound(byte[] in, java.lang.String format)
in
- The input soundformat
- The format it's inpublic void onStartup()
@Deprecated public void extensionsReady()
public abstract void onActivate()
public javax.swing.JPanel onGameCenterActivate()
public void onDestroy()
public abstract void onGameSave(stencyl.core.lib.Game game)
game
- The game that was saved.public abstract void onGameOpened(stencyl.core.lib.Game game)
game
- The game that was opened.public void onGameClosed(stencyl.core.lib.Game game)
game
- The game that was closed.public void onScreenCapture(java.awt.image.BufferedImage img)
img
- The resulting image from the screen capture.public abstract OptionsPanel onOptions()
public abstract void onInstall()
public abstract void onUninstall()
public void onGameBuild(stencyl.core.lib.Game game)
game
- The game that is being built.public boolean isKitSpecific()
A kit can bundle an extension (placed at [KIT_DIR]/extensions/)
onCreate.jar - Only run once at create-time. Unloaded immediately after.
Any other name - Loaded only when the game is opened, so hooks outside this context will not work.
The extensions unload when the kit or app is closed. If the app closes prematurely, they still will not load the next time the app starts.
public void onGameCreatedFromKit()
protected boolean hasOptions()
showOptions
.protected final void showOptions()
public int getID()
public void setID(int id)
@Deprecated public java.lang.String getClassname()
@Deprecated public java.lang.String getName()
@Deprecated public void setName(java.lang.String name)
@Deprecated public java.lang.String getDescription()
@Deprecated public void setDescription(java.lang.String description)
@Deprecated public java.lang.String getAuthorName()
@Deprecated public void setAuthorName(java.lang.String authorName)
@Deprecated public java.lang.String getWebsite()
@Deprecated public void setWebsite(java.lang.String website)
@Deprecated public int getInternalVersion()
@Deprecated public void setInternalVersion(int internalVersion)
@Deprecated public java.lang.String getVersion()
@Deprecated public void setVersion(java.lang.String version)
public int getCategory()
public void setCategory(int category)
@Deprecated public boolean isActive()
@Deprecated public void setActive(boolean isActive)
public void setMenuItem(javax.swing.JMenuItem item)
item
- Set the item in the Extensions menu to this custom JMenuItempublic boolean isInMenu()
public boolean isMenuItemInitiallyEnabled()
public void setInMenu(boolean isInMenu)
public java.lang.String getMenuName()
public void setMenuName(java.lang.String menuName)
public void setGameCenterItem(com.explodingpixels.macwidgets.SourceListItem item)
public boolean isInGameCenter()
public void setInGameCenter(boolean isInGameCenter)
public java.lang.String getGameCenterName()
public void setGameCenterName(java.lang.String gameCenterName)
public void enableMenu()
public void disableMenu()
public void setMenuText(java.lang.String t)
public void setGameCenterCount(int count)
count
- The number to appear next to your extension in the Dashboard sidebar.public void showInGameCenter()
@Deprecated public javax.swing.Icon getIcon()
public java.lang.Integer getImageSaveRequest()
public stencyl.sw.editors.snippet.designer.Definitions.DefinitionMap getDesignModeBlocks()
public java.lang.String toString()
toString
in class java.lang.Object
public stencyl.sw.ext.ExtensionManifest getManifest()
public void setManifest(stencyl.sw.ext.ExtensionManifest manifest)