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

📄 gamecanvas.html

📁 是MIDP 的API 查詢文件, 大家可以看一下裡面的index.html, 再用Package 或 Class 名字來查.
💻 HTML
📖 第 1 页 / 共 3 页
字号:
 (UP, DOWN, FIRE, etc.); key events are always generated for all other  keys.   <p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>suppressKeyEvents</CODE> - <code>true</code> to suppress the regular key event mechanism for game keys, otherwise <code>false</code>.</DL>
</DD>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="getGraphics()"><!-- --></A><H3>
getGraphics</H3>
<PRE>
protected <A HREF="../../../../javax/microedition/lcdui/Graphics.html">Graphics</A> <B>getGraphics</B>()</PRE>
<DL>
<DD>Obtains the Graphics object for rendering a GameCanvas.  The returned  Graphics object renders to the off-screen buffer belonging to this  GameCanvas. <p>	  Rendering operations do not appear on the display until flushGraphics() is called; flushing the buffer does not change its contents (the pixels are not cleared as a result of the flushing operation). <p> A new Graphics object is created and returned each time this method is called; therefore, the needed Graphics object(s) should be obtained  before the game starts then re-used while the game is running.   For each GameCanvas instance, all of the provided graphics objects will render to the same off-screen buffer.  <P> <P>The newly created Graphics object has the following properties: </P> <ul> <LI>the destination is this GameCanvas' buffer; <LI>the clip region encompasses the entire buffer; <LI>the current color is black; <LI>the font is the same as the font returned by <A HREF="../../../../javax/microedition/lcdui/Font.html#getDefaultFont()"><CODE>Font.getDefaultFont()</CODE></A>; <LI>the stroke style is <A HREF="../../../../javax/microedition/lcdui/Graphics.html#SOLID"><CODE>SOLID</CODE></A>; and <LI>the origin of the coordinate system is located at the upper-left corner of the buffer. </ul>      <p><DD><DL>
<DT><B>Returns:</B><DD>the Graphics object that renders to this GameCanvas'  off-screen buffer<DT><B>See Also: </B><DD><A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#flushGraphics()"><CODE>flushGraphics()</CODE></A>, 
<A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#flushGraphics(int, int, int, int)"><CODE>flushGraphics(int, int, int, int)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getKeyStates()"><!-- --></A><H3>
getKeyStates</H3>
<PRE>
public int <B>getKeyStates</B>()</PRE>
<DL>
<DD>Gets the states of the physical game keys.  Each bit in the returned integer represents a specific key on the device.  A key's bit will be 1 if the key is currently down or has been pressed at least once since the last time this method was called.  The bit will be 0 if the key is currently up and has not been pressed at all since the last time  this method was called.  This latching behavior ensures that a rapid key press and release will always be caught by the game loop,  regardless of how slowly the loop runs. <p> For example:<code><pre>       // Get the key state and store it      int keyState = getKeyStates();      if ((keyState & LEFT_KEY) != 0) {          positionX--;      }      else if ((keyState & RIGHT_KEY) != 0) {          positionX++;      } </pre></code> <p> Calling this method has the side effect of clearing any latched state. Another call to getKeyStates immediately after a prior call will  therefore report the system's best idea of the current state of the keys, the latched bits having been cleared by the first call. <p> Some devices may not be able to query the keypad hardware directly and therefore, this method may be implemented by monitoring key press and release events instead.  Thus the state reported by getKeyStates might lag the actual state of the physical keys since the timeliness of the key information is be subject to the capabilities of each device.  Also, some devices may be incapable of detecting simultaneous presses of multiple keys. <p> This method returns 0 unless the GameCanvas is currently visible as reported by <A HREF="../../../../javax/microedition/lcdui/Displayable.html#isShown()"><CODE>Displayable.isShown()</CODE></A>. Upon becoming visible, a GameCanvas will initially indicate that  all keys are unpressed (0); if a key is held down while the GameCanvas is being shown, the key must be first released and then pressed in  order for the key press to be reported by the GameCanvas. <p><DD><DL>
<DT><B>Returns:</B><DD>An integer containing the key state information (one bit per  key), or 0 if the GameCanvas is not currently shown.<DT><B>See Also: </B><DD><A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#UP_PRESSED"><CODE>UP_PRESSED</CODE></A>, 
<A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#DOWN_PRESSED"><CODE>DOWN_PRESSED</CODE></A>, 
<A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#LEFT_PRESSED"><CODE>LEFT_PRESSED</CODE></A>, 
<A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#RIGHT_PRESSED"><CODE>RIGHT_PRESSED</CODE></A>, 
<A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#FIRE_PRESSED"><CODE>FIRE_PRESSED</CODE></A>, 
<A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#GAME_A_PRESSED"><CODE>GAME_A_PRESSED</CODE></A>, 
<A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#GAME_B_PRESSED"><CODE>GAME_B_PRESSED</CODE></A>, 
<A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#GAME_C_PRESSED"><CODE>GAME_C_PRESSED</CODE></A>, 
<A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#GAME_D_PRESSED"><CODE>GAME_D_PRESSED</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="paint(javax.microedition.lcdui.Graphics)"><!-- --></A><H3>
paint</H3>
<PRE>
public void <B>paint</B>(<A HREF="../../../../javax/microedition/lcdui/Graphics.html">Graphics</A>&nbsp;g)</PRE>
<DL>
<DD>Paints this GameCanvas.  By default, this method renders the  the off-screen buffer at (0,0).  Rendering of the buffer is  subject to the clip region and origin translation of the Graphics object.<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../../javax/microedition/lcdui/Canvas.html#paint(javax.microedition.lcdui.Graphics)">paint</A></CODE> in class <CODE><A HREF="../../../../javax/microedition/lcdui/Canvas.html">Canvas</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>g</CODE> - the Graphics object with which to render the screen.<DT><B>Throws:</B><DD><CODE><A HREF="../../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>g</code> is <code>null</code></DL>
</DD>
</DL>
<HR>

<A NAME="flushGraphics(int, int, int, int)"><!-- --></A><H3>
flushGraphics</H3>
<PRE>
public void <B>flushGraphics</B>(int&nbsp;x,                          int&nbsp;y,                          int&nbsp;width,                          int&nbsp;height)</PRE>
<DL>
<DD>Flushes the specified region of the off-screen buffer to the display.  The contents of the off-screen buffer are not changed as a result of  the flush operation.  This method does not return until the flush has been completed, so the app may immediately begin to render the next  frame to the same buffer once this method returns. <p> If the specified region extends beyond the current bounds of the  GameCanvas, only the intersecting region is flushed.  No pixels are flushed if the specified width or height is less than 1. <p> This method does nothing and returns immediately if the GameCanvas is not currently shown or the flush request cannot be honored because the system is busy. <p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>x</CODE> - the left edge of the region to be flushed<DD><CODE>y</CODE> - the top edge of the region to be flushed<DD><CODE>width</CODE> - the width of the region to be flushed<DD><CODE>height</CODE> - the height of the region to be flushed<DT><B>See Also: </B><DD><A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#flushGraphics()"><CODE>flushGraphics()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="flushGraphics()"><!-- --></A><H3>
flushGraphics</H3>
<PRE>
public void <B>flushGraphics</B>()</PRE>
<DL>
<DD>Flushes the off-screen buffer to the display.  The size of the flushed  area is equal to the size of the GameCanvas.  The contents of the  off-screen buffer are not changed as a result of the flush  operation.  This method does not return until the flush has been completed, so the app may immediately begin to render the next frame to the same buffer once this method returns. <p> This method does nothing and returns immediately if the GameCanvas is not currently shown or the flush request cannot be honored because the system is busy. <p><DD><DL>
<DT><B>See Also: </B><DD><A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#flushGraphics(int, int, int, int)"><CODE>flushGraphics(int,int,int,int)</CODE></A></DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_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>
<font size="-1"><a href="mailto:midp-feedback@risc.sps.mot.com">Submit a comment or suggestion</a> Version 2.0 of MID Profile Specification<br>Java is a trademark or registered trademark of Sun Microsystems,  Inc. in the US and other countries. Copyright (c) 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road,Palo Alto, California, 94303, U.S.A.  All Rights Reserved.</font>
</BODY>
</HTML>

⌨️ 快捷键说明

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