Cool I downloaded the latest version, It now crashes on the Skewworks.Spiral.Graphics.Initialize methode with the following error:
An unhandled exception of type âSystem.InvalidOperationExceptionâ occurred in GHIElectronics.NETMF.Hardware.dll
The iTead module does not use a ReadPin and a Backlight pin so I used Cpu.Pin.GPIO_NONE is that correct?
Nope unfortunatly it is not, the FEZ Touch uses SPI, the iTeadStudio one does not, would it be possible for you to make the touch initialize methode so that I can use alternate pinout (without using SPI)? That would be great, because without touch it is a bit hard to use
Ok, so I would also like to use some big fonts to display for example temperature on the display, cannyou please post a short tutorial on how to make a font, because even with the sample picture I canât get it to work :-[
Thatâs more or less what Spiralâs Font Creator does but the images it makes a 1bit encoded to save on size. Maybe I should offer up the Font Creator for the communityâŚ
Another simple way to have bigger text without changing the font, is to zoom it by displaying each pixel twice. Of course, it looks a bit blocky and takes much more time to display, but no memory is wasted.
Hereâs sample code that needs to be replaced within FEZ_Components_FEZTouch.cs in the driver. Itâs pretty basic, but should work fine.
// Will only work with zoom = 1 or zoom = 2.
// Otherwise, the code would need to be changed much more by either
// 1) Increasing buffer size
// 2) Draw parts of letters within each buffer
public void DrawString(string str, int x, int y, Color foreColor, Color backColor, int zoom=1)
{
if (x < 0 || y < 0 || (x + str.Length * FONT_WIDTH * zoom) > ScreenWidth || (y + FONT_HEIGHT * zoom) > ScreenHeight)
throw new ArgumentException();
int index = 0;
int length;
// Max characters per buffer
int max_chars = BUFFERING_SIZE / (FONT_WIDTH * FONT_HEIGHT * 2 * zoom * zoom + 4);
// first four bytes are color in the buffer
buffer[0] = (byte)((int)foreColor >> 8);
buffer[1] = (byte)(foreColor);
buffer[2] = (byte)((int)backColor >> 8);
buffer[3] = (byte)(backColor);
while (index < str.Length)
{
length = (str.Length - index) > max_chars ? max_chars : (str.Length - index);
DrawString_Internal(x, y, str.Substring(index, length), zoom);
index += length;
x += length * FONT_WIDTH * zoom;
}
}
private void DrawString_Internal(int x, int y, string val, int zoom)
{
lcdCS.Write(false);
byte ch;
// get the foreground and background color bytes before any loops
byte bc0 = buffer[2];
byte bc1 = buffer[3];
byte fc0 = buffer[0];
byte fc1 = buffer[1];
// first four bytes are used for color
int bufferIndex = 4;
SetDrawingWindow(x, y, FONT_WIDTH * val.Length * zoom, FONT_HEIGHT * zoom);
for (int j = 0; j < (12*zoom); j++)
{
for (int currentChar = 0; currentChar < val.Length; currentChar++)
{
ch = font[((val[currentChar] - 32) * 12) + (int)(j/zoom)];
// use defined masks
for (int i = 0; i < 8; i++)
{
if ((ch & (1<<(8-i))) != 0)
{
for (int k = 0; k < zoom; k++)
{
buffer[bufferIndex + 2 * zoom * i + 2 * k] = fc0;
buffer[bufferIndex + 2 * zoom * i + 2 * k + 1] = fc1;
}
}
else
{
for (int k = 0; k < zoom; k++)
{
buffer[bufferIndex + 2 * zoom * i + 2 * k] = bc0;
buffer[bufferIndex + 2 * zoom * i + 2 * k + 1] = bc1;
}
}
}
bufferIndex += (16 * zoom);
}
}
SetRegister(REGISTER_WRITE_GRAM);
pp.Write(buffer, 4, bufferIndex - 4);
lcdCS.Write(true);
}
Yeah thereâs also RLE it all just depends on whats needed. I can always make it separate classes so it is only included when needed like I did w the full screen render and input dialogs.