Revolution-FX

Graphics

PlotPixel


Prototype:
  void PlotPixel(char x, char y, unsigned char *buffer, char draw_type);
Parameters:

x - Position along x-axis
y - Position along y-axis
buffer - The buffer to plot the pixel on
draw_type - Can be either: WHITE, BLACK or INVERT (These variables are defined in revolution.h)

Description: Plots a pixel at coordinate (x, y), based on it's draw_type, onto a buffer.

Example:
  unsigned char buffer[1024];			// Declare our buffer: (128x64)/8 = 1024 bytes
  
  memset(&buffer, 0, 1024);			// Clear the buffer
  
  PlotPixel(64, 32, &buffer, BLACK);		// Plots a pixel in the center
  DrawAll(&buffer);				// Draws the buffer
  
  while (IsKeyDown(KEY_CTRL_EXE) != 1)		// Don't use GetKey with DrawAll
  {
  }

DrawLine


Prototype:
  void DrawLine(char x1, char y1, char x2, char y2, unsigned char *buffer, char color);
Parameters:

x1 - Position along x-axis for 1st coordinate
y1 - Position along y-axis for 1st coordinate
x2 - Position along x-axis for 2nd coordinate
y2 - Position along y-axis for 2nd coordinate
buffer - The buffer to plot the line on
color - The color of the line

Description: Draws a line starting at (x1, y1) to (x2, y2) onto buffer with the color indicated by color).

Example:
  unsigned char buffer[1024];			// Declare our buffer
  

  memset(&buffer, 0, 1024);			// Clear buffer

  DrawLine(0, 0, 127, 63, &buffer, BLACK);	// Draw the line
  DrawAll(&buffer);				// Draw buffer to screen

  while (IsKeyDown(KEY_CTRL_EXE) != 1)		// Don't use GetKey with DrawAll
  {
  }
  

DrawSprite8


Prototype:
  void DrawSprite8(char x, char y, unsigned char *buffer, char *bitmap, int trans);
Parameters:

x - Position along x-axis
y - Position along y-axis
buffer - The buffer to plot the pixel on
bitmap - The sprite to draw
trans - Enables transparency if set to 1

Description: Draws a 8x8 pixel bitmap onto a buffer at coordinate (x, y) and with transparency if trans is 1.

Example:
  unsigned char buffer[1024];			// Declare our buffer
  
  // Bitmap of a box
  unsigned char box[8] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };

  memset(&buffer, 0, 1024);			// Clear buffer

  DrawSprite8(60, 28, buffer, box, 0);		// Draws the box onto buffer
  DrawAll(&buffer);				// Draw buffer to screen

  while (IsKeyDown(KEY_CTRL_EXE) != 1)		// Don't use GetKey with DrawAll
  {
  }
  

DrawSprite8x16


Prototype:
  void DrawSprite8x16(char x, char y, unsigned char *buffer, char *bitmap, int trans);
Parameters:

x - Position along x-axis
y - Position along y-axis
buffer - The buffer to plot the pixel on
bitmap - The sprite to draw
trans - Enables transparency if set to 1

Description: Similar to DrawSprite8, but instead draws a 8(width) x 16 (height) pixel bitmap onto a buffer at coordinate (x, y).

Example:
  unsigned char buffer[1024];			// Declare our buffer
  
  // Bitmap of a rectangle
  unsigned char rectangle[16] = 
  {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};

  memset(&buffer, 0, 1024);			// Clear buffer

  DrawSprite8(60, 24, buffer, rectangle, 0);	// Draws the rectangle onto buffer
  DrawAll(&buffer);				// Draw buffer to screen

  while (IsKeyDown(KEY_CTRL_EXE) != 1)		// Don't use GetKey with DrawAll
  {
  }
  

DrawSprite16


Prototype:
  void DrawSprite16(char x, char y, unsigned char *buffer, char *bitmap, int trans);
Parameters:

x - Position along x-axis
y - Position along y-axis
buffer - The buffer to plot the pixel on
bitmap - The sprite to draw
trans - Enables transparency if set to 1

Description: Similar to DrawSprite8, but instead draws a 16(width) x 16 (height) pixel bitmap onto a buffer at coordinate (x, y).


DrawSprite32


Prototype:
  void DrawSprite32(char x, char y, unsigned char *buffer, char *bitmap, int trans);
Parameters:

x - Position along x-axis
y - Position along y-axis
buffer - The buffer to plot the pixel on
bitmap - The sprite to draw
trans - Enables transparency if set to 1

Description: Similar to DrawSprite8, but instead draws a 32(width) x 32 (height) pixel bitmap onto a buffer at coordinate (x, y).


DDrawSprite8


Prototype:
  void DDrawSprite8(char x, char y, unsigned char *buffer1, unsigned char *buffer2, 
    char *bitmap, char *bitmap2, int trans);
Parameters:

x - Position along x-axis
y - Position along y-axis
buffer1 - The buffer to plot the first sprite on
buffer2 - The buffer to plot the second sprite on
bitmap - The first sprite
bitmap2 - The second sprite
trans - Enables transparency if set to 1

Description: Similar to DrawSprite's, but instead draws a sprite for each buffer. A 8 (width) x 8 (height) pixel bitmap & bitmap2 are drawn onto buffer1 & buffer2 at coordinate (x, y) respectively.


DDrawSprite8x16


Prototype:
  void DDrawSprite8x16(char x, char y, unsigned char *buffer1, unsigned char *buffer2, 
    char *bitmap, char *bitmap2, int trans);
Parameters:

x - Position along x-axis
y - Position along y-axis
buffer1 - The buffer to plot the first sprite on
buffer2 - The buffer to plot the second sprite on
bitmap - The first sprite
bitmap2 - The second sprite
trans - Enables transparency if set to 1

Description: Similar to DrawSprite's, but instead draws a sprite for each buffer. A 8 (width) x 16 (height) pixel bitmap & bitmap2 are drawn onto buffer1 & buffer2 at coordinate (x, y) respectively.


DDrawSprite16


Prototype:
  void DDrawSprite16(char x, char y, unsigned char *buffer1, unsigned char *buffer2, 
    char *bitmap, char *bitmap2, int trans)
Parameters:

x - Position along x-axis
y - Position along y-axis
buffer1 - The buffer to plot the first sprite on
buffer2 - The buffer to plot the second sprite on
bitmap - The first sprite
bitmap2 - The second sprite
trans - Enables transparency if set to 1

Description: Similar to DrawSprite's, but instead draws a sprite for each buffer. A 16 (width) x 16 (height) pixel bitmap & bitmap2 are drawn onto buffer1 & buffer2 at coordinate (x, y) respectively.


DrawAll


Prototype:
  void DrawAll(unsigned long *buffer);
Parameters:

buffer - The buffer to be drawn onto the screen.

Description: DrawAll is a easy and fast way to draw buffer onto the screen.

Example: Look at previous code examples on this page for examples of DrawAll.

GrayInit


Prototype:
  void GrayInit(int countdown, int countdown2);
Parameters:

countdown - The initial timer value for the first buffer.
countdown2 - The initial timer value for the second buffer.

Description: GrayInit starts the grayscale engine and stores the values countdown & countdown2 as the starting point for the buffer timers when they count down.


Example:
  int x, y;

  unsigned long buffer1[256] = { 0 };		// Declare the buffers
  unsigned long buffer2[256] = { 0 };
	
  GrayLinkBuffers(&buffer1, &buffer2);		// Link them together
  GrayInit(3661, 3661);				// Load the timers with 3661
	
  x = 64 - 8;
  y = 32 - 8;

  while(IsKeyDown(KEY_CTRL_EXIT) != 1)
  {
  	if (IsKeyDown(KEY_CTRL_RIGHT) == 1)
  	{
  		memset(buffer1, 0, sizeof(buffer1));
  		memset(buffer2, 0, sizeof(buffer2));
  		x = x + 1;
  	}
  	if (IsKeyDown(KEY_CTRL_LEFT) == 1)
  	{
  		memset(buffer1, 0, sizeof(buffer1));
  		memset(buffer2, 0, sizeof(buffer2));
  		x = x - 1;
  	}
  	if (IsKeyDown(KEY_CTRL_UP) == 1)
  	{
  		memset(buffer1, 0, sizeof(buffer1));
  		memset(buffer2, 0, sizeof(buffer2));
  		y = y - 1;
  	}
  	if (IsKeyDown(KEY_CTRL_DOWN) == 1)
  	{
  		memset(buffer1, 0, sizeof(buffer1));
  		memset(buffer2, 0, sizeof(buffer2));
  		y = y + 1;
  	}
  	DrawSprite8(x, y, buffer1, box);
  	DrawSprite8(x, y, buffer1, box);	// I have to add more stuff to make it work
  }
  

GrayInit3


Prototype:
  void GrayInit3(int countdown, int countdown2, int countdown3);
Parameters:

countdown - The initial timer value for the first buffer.
countdown2 - The initial timer value for the second buffer.
countdown3 - The initial timer value for the third buffer.

Description: GrayInit3 starts the grayscale engine and stores the values countdown, countdown2 & countdown3 as the starting point for the buffer timers when they count down.


GrayLinkBuffers


Prototype:
  void GrayLinkBuffers(unsigned long *buffer1, unsigned long *buffer2);
Parameters:

buffer1 - The first buffer
buffer2 - The second buffer

Description: Tells the grayscale engine which two buffers you want to use.

Example: Look at GrayInit for a code example.


GrayLinkBuffers3


Prototype:
  void GrayLinkBuffers(unsigned long *buffer1, unsigned long *buffer2, unsigned long *buffer3);
Parameters:

buffer1 - The first buffer
buffer2 - The second buffer

buffer3 - The third buffer

Description: Tells the grayscale engine which three buffers you want to use for a possible of 8 colors.



GrayEnd


Prototype:
  void GrayEnd();
Parameter: None

Description: Shuts off the grayscale engine by turning off the timers.


CopyVRAM


Prototype:
  void CopyVRAM(unsigned int *buffer);
Parameter:

buffer - The buffer in which VRAM is copied to.

Description: Copies the VRAM into buffer. Useful for drawing first to the VRAM using Bdisp_ functions from CASIO fx-9860G's SDK library, then copying to a buffer for use with Revolution-FX.


Change_Contrast


Prototype:
  void Change_Contrast(char contrast);
Parameter:

contrast - Variable for the LCD's contrast.

Description: Changes the LCD's contrast. There's a tutorial on using Change_Contrast in the Tutorials section.



SourceForge.net LogoContact Us | ©2007 Revolution-FX Development Team