http://uzebox.org/wiki/index.php?title=Global_Vram&feed=atom&action=historyGlobal Vram - Revision history2024-03-28T10:05:22ZRevision history for this page on the wikiMediaWiki 1.38.5http://uzebox.org/wiki/index.php?title=Global_Vram&diff=1522&oldid=prevPaul at 22:41, 25 February 20102010-02-25T22:41:26Z<p></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 22:41, 25 February 2010</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l20">Line 20:</td>
<td colspan="2" class="diff-lineno">Line 20:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> OR</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> OR</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> SetTile(ballX>>3, (ballY>>3) * VRAM_TILES_H, TILE_SHADOW);</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> SetTile(ballX>>3, (ballY>>3) * VRAM_TILES_H, TILE_SHADOW);</div></td></tr>
<tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">* '''Video Modes''': All</ins></div></td></tr>
</table>Paulhttp://uzebox.org/wiki/index.php?title=Global_Vram&diff=1520&oldid=prevPaul: New page: The '''vram''' global variable is the array of tiles that will be drawn to the screen each frame. You can access it's elements directly or you can do so indirectly through [[Function_SetTi...2010-02-25T22:40:34Z<p>New page: The '''vram''' global variable is the array of tiles that will be drawn to the screen each frame. You can access it's elements directly or you can do so indirectly through [[Function_SetTi...</p>
<p><b>New page</b></p><div>The '''vram''' global variable is the array of tiles that will be drawn to the screen each frame. You can access it's elements directly or you can do so indirectly through [[Function_SetTile|SetTile]]. To query it, you must access it directly. The exact size of the vram array is dependent on your Video Mode, but it's always VRAM_TILES_V * VRAM_TILES_H. For Video Mode 3, ram tiles will occupy the first RAM_TILES_COUNT elements of vram. Using [[Function_SetTile|SetTile]] will shelter you from these details.<br />
<br />
Example:<br />
<br />
#define TILE_WOOD 0<br />
#define TILE_SAND 1<br />
#define TILE_SHADOW 2<br />
#define SLOW 3<br />
#define FAST 6<br />
<br />
u8 ballX, ballY; // Pixel precision<br />
char ballVelX, ballVelY;<br />
...<br />
if (vram[(ballY>>3) * VRAM_TILES_H + (ballX>>3)] == TILE_WOOD)<br />
ballVelX = FAST;<br />
else if (vram[(ballY>>3) * VRAM_TILES_H + (ballX>>3)] == TILE_SAND)<br />
ballVelY = SLOW;<br />
...<br />
vram[(ballY>>3) * VRAM_TILES_H + (ballX>>3)] = TILE_SHADOW;<br />
OR<br />
SetTile(ballX>>3, (ballY>>3) * VRAM_TILES_H, TILE_SHADOW);</div>Paul