Commit 5e386595 authored by Stephanie Gawroriski's avatar Stephanie Gawroriski
Browse files

Base classes that will be used for a Swing backed framebuffer display.

parent 43f1a7c1
......@@ -1760,6 +1760,8 @@ public final class Assembly
case SystemCallIndex.ERROR_GET:
case SystemCallIndex.ERROR_SET:
case SystemCallIndex.EXIT:
case SystemCallIndex.FRAMEBUFFER_PROPERTY:
case SystemCallIndex.IPC_CALL:
case SystemCallIndex.GARBAGE_COLLECT:
case SystemCallIndex.LOAD_STRING:
case SystemCallIndex.PD_OF_STDERR:
......@@ -1909,6 +1911,25 @@ public final class Assembly
}
break;
// Property of the framebuffer
case SystemCallIndex.FRAMEBUFFER_PROPERTY:
try
{
rv = SwingFramebuffer.instance().vfb.framebufferProperty(
__args);
err = 0;
}
catch (Throwable t)
{
// Print the exception
t.printStackTrace();
// Drop
rv = 0;
err = SystemCallError.NO_FRAMEBUFFER;
}
break;
// Invoke the garbage collector
case SystemCallIndex.GARBAGE_COLLECT:
{
......@@ -1918,6 +1939,10 @@ public final class Assembly
err = 0;
}
break;
// IPC Call
case SystemCallIndex.IPC_CALL:
throw new todo.TODO();
// Loads a string
case SystemCallIndex.LOAD_STRING:
......
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package cc.squirreljme.jvm;
import cc.squirreljme.runtime.lcdui.vfb.VirtualFramebuffer;
/**
* This is a framebuffer that uses Java SE's Swing framework.
*
* @since 2019/12/28
*/
public final class SwingFramebuffer
{
/** The singular created instance. */
private static SwingFramebuffer _INSTANCE;
/** Virtual framebuffer to use. */
protected final VirtualFramebuffer vfb =
new VirtualFramebuffer(new DefaultIPCRouter());
/**
* Returns an instance of the framebuffer.
*
* @return The framebuffer instance.
* @since 2019/12/28
*/
public static final SwingFramebuffer instance()
{
SwingFramebuffer rv = _INSTANCE;
if (rv == null)
_INSTANCE = (rv = new SwingFramebuffer());
return rv;
}
}
......@@ -54,6 +54,7 @@ import net.multiphasicapps.io.MIMEFileDecoder;
*
* @since 2018/11/16
*/
@Deprecated
public final class NativeDisplayAccess
{
/** The number of parameters available. */
......
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package cc.squirreljme.jvm;
/**
* This is a router which just forward IPC requests to the standard manager.
*
* @since 2019/12/28
*/
public final class DefaultIPCRouter
implements IPCCallback
{
/**
* {@inheritDoc}
* @since 2019/12/28
*/
@Override
public final long ipcCall(int __tid, int __ipcid, int __a, int __b,
int __c, int __d, int __e, int __f, int __g, int __h)
{
return IPCManager.ipcCall(__tid, __ipcid, __a, __b, __c, __d, __e,
__f, __g, __h);
}
}
......@@ -19,29 +19,36 @@ package cc.squirreljme.runtime.cldc.asm;
*
* @since 2018/12/03
*/
@Deprecated
public interface NativeDisplayEventCallback
{
/** Key pressed. */
@Deprecated
public static final int KEY_PRESSED =
1;
/** Key repeated. */
@Deprecated
public static final int KEY_REPEATED =
2;
/** Key released. */
@Deprecated
public static final int KEY_RELEASED =
3;
/** Pointer pressed. */
@Deprecated
public static final int POINTER_PRESSED =
4;
/** Pointer dragged. */
@Deprecated
public static final int POINTER_DRAGGED =
5;
/** Pointer released. */
@Deprecated
public static final int POINTER_RELEASED =
6;
......@@ -64,6 +71,7 @@ public interface NativeDisplayEventCallback
* @param __d The display which the close was performed on.
* @since 2018/12/03
*/
@Deprecated
public abstract void exitRequest(int __d);
/**
......@@ -76,6 +84,7 @@ public interface NativeDisplayEventCallback
* @param __time Timecode.
* @since 2018/12/03
*/
@Deprecated
public abstract void keyEvent(int __d, int __ty, int __kc, int __ch,
int __time);
......@@ -86,6 +95,7 @@ public interface NativeDisplayEventCallback
*
* @since 2018/12/10
*/
@Deprecated
public abstract void lostCallback();
/**
......@@ -98,6 +108,7 @@ public interface NativeDisplayEventCallback
* @param __h The height.
* @since 2018/12/03
*/
@Deprecated
public abstract void paintDisplay(int __d, int __x, int __y,
int __w, int __h);
......@@ -111,6 +122,7 @@ public interface NativeDisplayEventCallback
* @param __time Timecode.
* @since 2018/12/03
*/
@Deprecated
public abstract void pointerEvent(int __d, int __ty, int __x, int __y,
int __time);
......@@ -121,6 +133,7 @@ public interface NativeDisplayEventCallback
* @param __shown If this is non-zero the display is shown.
* @since 2018/12/03
*/
@Deprecated
public abstract void shown(int __d, int __shown);
/**
......@@ -131,6 +144,7 @@ public interface NativeDisplayEventCallback
* @param __h The height of the display.
* @since 2018/12/03
*/
@Deprecated
public abstract void sizeChanged(int __d, int __w, int __h);
}
......@@ -10,8 +10,6 @@
package cc.squirreljme.runtime.lcdui.vfb;
import cc.squirreljme.jvm.IPCCallback;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;
/**
* This is a virtual framebuffer which may be used by non-SquirrelJME JVMs and
......@@ -20,8 +18,15 @@ import javax.microedition.lcdui.Graphics;
* @since 2019/12/28
*/
public final class VirtualFramebuffer
extends Canvas
{
/** The default width. */
public static final int DEFAULT_WIDTH =
320;
/** The default height. */
public static final int DEFAULT_HEIGHT =
200;
/** The callback to invoke with screen actions. */
protected final IPCCallback ipc;
......@@ -38,95 +43,31 @@ public final class VirtualFramebuffer
if (__ipc == null)
throw new NullPointerException("NARG");
// Set IPC to use
this.ipc = __ipc;
}
/**
* {@inheritDoc}
* @since 2018/12/28
*/
@Override
public final void keyPressed(int __kc)
{
throw new todo.TODO();
}
/**
* {@inheritDoc}
* @since 2018/12/28
*/
@Override
public final void keyReleased(int __kc)
{
throw new todo.TODO();
}
/**
* {@inheritDoc}
* @since 2018/12/28
*/
@Override
public final void keyRepeated(int __kc)
{
throw new todo.TODO();
}
/**
* {@inheritDoc}
* @since 2018/12/28
*/
@Override
public final void paint(Graphics __g)
{
throw new todo.TODO();
}
/**
* {@inheritDoc}
* @since 2018/12/28
*/
@Override
public final void pointerDragged(int __x, int __y)
{
throw new todo.TODO();
}
/**
* {@inheritDoc}
* @since 2018/12/28
*/
@Override
public final void pointerPressed(int __x, int __y)
{
throw new todo.TODO();
}
/**
* {@inheritDoc}
* @since 2018/12/28
*/
@Override
public final void pointerReleased(int __x, int __y)
{
throw new todo.TODO();
}
/**
* {@inheritDoc}
* @since 2018/12/28
* Executes the framebuffer property system call.
*
* @param __args The call arguments.
* @return The result of the property.
* @since 2019/12/28
*/
@Override
public final void showNotify()
public final long framebufferProperty(int... __args)
{
throw new todo.TODO();
}
/**
* {@inheritDoc}
* @since 2018/12/28
* Executes the framebuffer property system call.
*
* @param __pid The property ID.
* @param __args The call arguments.
* @return The result of the property.
* @since 2019/12/28
*/
@Override
public final void sizeChanged(int __w, int __h)
public final long framebufferProperty(int __pid, int... __args)
{
throw new todo.TODO();
}
......
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package cc.squirreljme.runtime.lcdui.vfb;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
/**
* This is a virtualized framebuffer that provides a LCDUI canvas.
*
* @see VirtualFramebuffer
* @since 2019/12/28
*/
public final class VirtualFramebufferCanvas
extends Canvas
{
/** The framebuffer to use. */
protected final VirtualFramebuffer framebuffer;
/**
* Initializes the framebuffer canvas.
*
* @param __fb The framebuffer.
* @throws NullPointerException On null arguments.
* @since 2019/12/28
*/
public VirtualFramebufferCanvas(VirtualFramebuffer __fb)
throws NullPointerException
{
if (__fb == null)
throw new NullPointerException("NARG");
this.framebuffer = __fb;
}
/**
* {@inheritDoc}
* @since 2018/12/28
*/
@Override
public final void keyPressed(int __kc)
{
throw new todo.TODO();
}
/**
* {@inheritDoc}
* @since 2018/12/28
*/
@Override
public final void keyReleased(int __kc)
{
throw new todo.TODO();
}
/**
* {@inheritDoc}
* @since 2018/12/28
*/
@Override
public final void keyRepeated(int __kc)
{
throw new todo.TODO();
}
/**
* {@inheritDoc}
* @since 2018/12/28
*/
@Override
public final void paint(Graphics __g)
{
throw new todo.TODO();
}
/**
* {@inheritDoc}
* @since 2018/12/28
*/
@Override
public final void pointerDragged(int __x, int __y)
{
throw new todo.TODO();
}
/**
* {@inheritDoc}
* @since 2018/12/28
*/
@Override
public final void pointerPressed(int __x, int __y)
{
throw new todo.TODO();
}
/**
* {@inheritDoc}
* @since 2018/12/28
*/
@Override
public final void pointerReleased(int __x, int __y)
{
throw new todo.TODO();
}
/**
* {@inheritDoc}
* @since 2018/12/28
*/
@Override
public final void showNotify()
{
throw new todo.TODO();
}
/**
* {@inheritDoc}
* @since 2018/12/28
*/
@Override
public final void sizeChanged(int __w, int __h)
{
throw new todo.TODO();
}
}
......@@ -21,6 +21,7 @@ import cc.squirreljme.runtime.cldc.lang.ApiLevel;
*
* @since 2018/11/09
*/
@Deprecated
public final class NativeDisplayAccess
{
/** The number of parameters available. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment