⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gamecanvas.html

📁 是MIDP 的API 查詢文件, 大家可以看一下裡面的index.html, 再用Package 或 Class 名字來查.
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Wed Sep 24 14:57:50 PDT 2003 -->
<TITLE>
MID Profile: Class  GameCanvas
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/GameCanvas.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<strong>MID Profile</strong></EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../../javax/microedition/lcdui/game/Layer.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="GameCanvas.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
javax.microedition.lcdui.game</FONT>
<BR>
Class  GameCanvas</H2>
<PRE>
<A HREF="../../../../java/lang/Object.html">java.lang.Object</A>
  |
  +--<A HREF="../../../../javax/microedition/lcdui/Displayable.html">javax.microedition.lcdui.Displayable</A>
        |
        +--<A HREF="../../../../javax/microedition/lcdui/Canvas.html">javax.microedition.lcdui.Canvas</A>
              |
              +--<B>javax.microedition.lcdui.game.GameCanvas</B>
</PRE>
<HR>
<DL>
<DT>public abstract class <B>GameCanvas</B><DT>extends <A HREF="../../../../javax/microedition/lcdui/Canvas.html">Canvas</A></DL>

<P>
The GameCanvas class provides the basis for a game user interface.  In addition to the features inherited from Canvas (commands, input events, etc.) it also provides game-specific capabilities such as an off-screen graphics buffer and the ability to query key status. <p> A dedicated buffer is created for each GameCanvas instance.  Since a unique buffer is provided for each GameCanvas instance, it is preferable to re-use a single GameCanvas instance in the interests of minimizing heap usage.  The developer can assume that the contents of this buffer are modified only by calls to the Graphics object(s) obtained from the GameCanvas instance; the contents are not modified by external sources such as other MIDlets or system-level notifications.  The buffer is initially filled with white pixels. <p> The buffer's size is set to the maximum dimensions of the GameCanvas. However, the area that may be flushed is limited by the current dimensions of the GameCanvas (as influenced by the presence of a Ticker, Commands, etc.) when the flush is requested.  The current dimensions of the GameCanvas may be obtained by calling <A HREF="../../../../javax/microedition/lcdui/Displayable.html#getWidth()"><CODE>getWidth</CODE></A> and <A HREF="../../../../javax/microedition/lcdui/Displayable.html#getHeight()"><CODE>getHeight</CODE></A>. <p> A game may provide its own thread to run the game loop.  A typical loop will check for input, implement the game logic, and then render the updated user interface. The following code illustrates the structure of a typcial game loop: <code> <pre> // Get the Graphics object for the off-screen buffer Graphics g = getGraphics(); while (true) {      // Check user input and update positions if necessary      int keyState = getKeyStates();      if ((keyState & LEFT_PRESSED) != 0) {          sprite.move(-1, 0);      }      else if ((keyState & RIGHT_PRESSED) != 0) {          sprite.move(1, 0);      }	// Clear the background to white	g.setColor(0xFFFFFF);	g.fillRect(0,0,getWidth(), getHeight());      // Draw the Sprite      sprite.paint(g);      // Flush the off-screen buffer      flushGraphics(); } </pre> </code> <P>
<P>
<DL>
<DT><B>Since: </B><DD>MIDP 2.0</DD>
</DL>
<HR>

<P>
<!-- ======== INNER CLASS SUMMARY ======== -->


<!-- =========== FIELD SUMMARY =========== -->

<A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#DOWN_PRESSED">DOWN_PRESSED</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The bit representing the DOWN key.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#FIRE_PRESSED">FIRE_PRESSED</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The bit representing the FIRE key.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#GAME_A_PRESSED">GAME_A_PRESSED</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The bit representing the GAME_A key (may not be supported on all  devices).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#GAME_B_PRESSED">GAME_B_PRESSED</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The bit representing the GAME_B key (may not be supported on all  devices).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#GAME_C_PRESSED">GAME_C_PRESSED</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The bit representing the GAME_C key (may not be supported on all  devices).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#GAME_D_PRESSED">GAME_D_PRESSED</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The bit representing the GAME_D key (may not be supported on all  devices).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#LEFT_PRESSED">LEFT_PRESSED</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The bit representing the LEFT key.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#RIGHT_PRESSED">RIGHT_PRESSED</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The bit representing the RIGHT key.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#UP_PRESSED">UP_PRESSED</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The bit representing the UP key.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="fields_inherited_from_class_javax.microedition.lcdui.Canvas"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Fields inherited from class javax.microedition.lcdui.<A HREF="../../../../javax/microedition/lcdui/Canvas.html">Canvas</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../javax/microedition/lcdui/Canvas.html#DOWN">DOWN</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#FIRE">FIRE</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#GAME_A">GAME_A</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#GAME_B">GAME_B</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#GAME_C">GAME_C</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#GAME_D">GAME_D</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#KEY_NUM0">KEY_NUM0</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#KEY_NUM1">KEY_NUM1</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#KEY_NUM2">KEY_NUM2</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#KEY_NUM3">KEY_NUM3</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#KEY_NUM4">KEY_NUM4</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#KEY_NUM5">KEY_NUM5</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#KEY_NUM6">KEY_NUM6</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#KEY_NUM7">KEY_NUM7</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#KEY_NUM8">KEY_NUM8</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#KEY_NUM9">KEY_NUM9</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#KEY_POUND">KEY_POUND</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#KEY_STAR">KEY_STAR</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#LEFT">LEFT</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#RIGHT">RIGHT</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#UP">UP</A></CODE></TD>
</TR>
</TABLE>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -