Exemplo n.º 1
0
/*
 *	DIFFERENT FROM C LIB:
 * 	oledDrawFromFile() 
 */
static PyObject* pyOledDrawFromFile(PyObject* self, PyObject* args)
{
	int 		status;
	uint8_t		*buffer;
	const char 	*filename;

	// parse the arguments
	if (!PyArg_ParseTuple(args, "s", &filename) ) {
		return NULL;
	}

	// allocate memory for the buffer
	buffer 	= malloc(OLED_EXP_WIDTH*OLED_EXP_HEIGHT/8 * sizeof *buffer);

	// read LCD data from file
	status 	= oledReadLcdFile ((char*)filename, buffer);

	if (status != EXIT_SUCCESS) {
		PyErr_SetString(PyExc_IOError, wrmsg_file);
		return NULL;
	}

	// draw data onto screen
	status 	= oledDraw (buffer, OLED_EXP_WIDTH*OLED_EXP_HEIGHT/8);

	if (status != EXIT_SUCCESS) {
		PyErr_SetString(PyExc_IOError, wrmsg_i2c);
		return NULL;
	}


	return Py_BuildValue("i", status);
}
Exemplo n.º 2
0
void render_lives() {

    if (game_mode == GAME_MODE_INFINITE) {
        return;
    }

    int padding = 5;
    for (int i = 0; i < lives; i++)
    {
        oledDraw(bitBall, (right_wall_posn + 10) + (i * padding), 23, bitBallY, bitBallX);
    }

    return;
}
Exemplo n.º 3
0
void render_right_wall() {

    oledDraw(right_wall_bm, right_wall_posn, 0, 2, 32);

    return;
}
Exemplo n.º 4
0
void render_ball() {

    oledDraw(bitBall, ball_x_posn, ball_y_posn, bitBallY, bitBallX);

    return;
}
Exemplo n.º 5
0
void render_paddle() {

    oledDraw(bitmap, paddle_x_posn, paddle_y1_posn, bitmapWidth, bitmapHeight);

    return;
}