public class CoronaView
extends FrameLayout
Modifier and Type | Class and Description |
---|---|
static interface |
CoronaView.CoronaEventListener
The object that will be called when an event
is sent from lua to a
CoronaView . |
static interface |
CoronaView.SendEventListener
The callback from calls to
sendEvent() . |
Constructor and Description |
---|
CoronaView(Context context) |
CoronaView(Context context,
AttributeSet attrs) |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Deinitializes the
CoronaView and releases the resources associated with the
CoronaView . |
void |
init()
Initalizes the
CoronaView so that it can be used. |
void |
init(String baseDir)
Initalizes the
CoronaView so that it can be used. |
protected void |
onRestoreInstanceState(Parcelable state)
Hook allowing a view to re-apply a representation of
its internal state that had previously been generated by
onSaveInstanceState() . |
protected Parcelable |
onSaveInstanceState()
Hook allowing a view to generate a representation of
its internal state that can later be used to create a new instance with that same state.
|
void |
pause()
Pauses the
CoronaView , stopping rendering. |
void |
resume()
Starts rendering the
CoronaView . |
void |
sendEvent(Hashtable<Object,Object> hashtable)
Dispatches the given hash table as a Lua
runtime
event,
to be received by Lua listeners that have been registered via the
Runtime:addEventListener()
function.
|
void |
sendEvent(Hashtable<Object,Object> hashtable,
CoronaView.SendEventListener listener)
Dispatches the given hash table as a Lua
runtime
event,
to be received by Lua listeners that have been registered via the
Runtime:addEventListener()
function.
|
void |
setCoronaEventListener(CoronaView.CoronaEventListener listener)
Registers a
CoronaEventListener to be called when
coronaView
events are fired from lua. |
void |
setOnKeyListener(View.OnKeyListener listener)
Register a callback to be invoked when a hardware key is pressed in this
CoronaView . |
void |
setZOrderMediaOverlay(boolean isMediaOverlay)
Control whether the GLSurfaceView's surface
is placed on top of another regular SurfaceView
in the Window (but still behind the
Window itself).
|
public CoronaView(Context context)
public CoronaView(Context context, AttributeSet attrs)
protected void onRestoreInstanceState(Parcelable state)
onSaveInstanceState()
.
This function will never be called with a null state.
state
- The frozen state that had previously been returned by
onSaveInstanceState()
.protected Parcelable onSaveInstanceState()
Some examples of things you may store here: the current cursor position in a TextView (but usually not the text itself since that is stored in a ContentProvider or other persistent storage), the currently selected item in a list view.
public void init()
CoronaView
so that it can be used. Uses the base "assets" directory as the base
Corona project directory.
This must be the first function you call!
public void init(String baseDir)
CoronaView
so that it can be used.
This must be the first function you call!
baseDir
- The directory of the Corona project relative to the "assests" directory.public void setOnKeyListener(View.OnKeyListener listener)
CoronaView
. Key
presses in software input methods will generally not trigger the methods of this listener.listener
- The key listener to
attach to this CoronaView
.public void resume()
CoronaView
.public void pause()
CoronaView
, stopping rendering.
Do not call before calling init()
!
public void setZOrderMediaOverlay(boolean isMediaOverlay)
Note: This must be set before the GLSurfaceView's containing Window is attached to the WindowManager.
public void destroy()
CoronaView
and releases the resources associated with the
CoronaView
.public void setCoronaEventListener(CoronaView.CoronaEventListener listener)
CoronaEventListener
to be called when
coronaView
events are fired from lua.listener
- The CoronaEventListener
to invoke for
coronaView
events.public void sendEvent(Hashtable<Object,Object> hashtable)
hashtable
- A Hashtable
which will be converted to a
lua table and dispatched.
Must contain an entry with a key set to "name" and value set to the unique name of the event to be received by a Lua listener.
public void sendEvent(Hashtable<Object,Object> hashtable, CoronaView.SendEventListener listener)
hashtable
- A Hashtable
which will be converted to a
lua table and dispatched.
Must contain an entry with a key set to "name" and value set to the unique name of the event to be received by a Lua listener.
listener
- SendEventListener
where the result of
sendEvent()
will be sent.
The result will be send on the thread which called CoronaView.init()
.