Add Quad drawing option
This commit is contained in:
parent
cb88fd7c2b
commit
b60775fa50
1
libs/core/enums.d.ts
vendored
1
libs/core/enums.d.ts
vendored
@ -12,6 +12,7 @@
|
|||||||
Fill = 0x04,
|
Fill = 0x04,
|
||||||
Transparent = 0x08,
|
Transparent = 0x08,
|
||||||
Double = 0x10,
|
Double = 0x10,
|
||||||
|
Quad = 0x20,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto-generated. Do not edit. Really.
|
// Auto-generated. Do not edit. Really.
|
||||||
|
@ -12,6 +12,7 @@ enum class Draw {
|
|||||||
Fill = 0x04,
|
Fill = 0x04,
|
||||||
Transparent = 0x08,
|
Transparent = 0x08,
|
||||||
Double = 0x10,
|
Double = 0x10,
|
||||||
|
Quad = 0x20,
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator&(Draw a, Draw b) {
|
inline bool operator&(Draw a, Draw b) {
|
||||||
@ -22,7 +23,6 @@ inline Draw operator|(Draw a, Draw b) {
|
|||||||
return (Draw)((int)a | (int)b);
|
return (Draw)((int)a | (int)b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define XX(v) ((uint32_t)(v)&0xffff)
|
#define XX(v) ((uint32_t)(v)&0xffff)
|
||||||
#define YY(v) ((uint32_t)(v) >> 16)
|
#define YY(v) ((uint32_t)(v) >> 16)
|
||||||
|
|
||||||
@ -171,8 +171,14 @@ Buffer doubleIcon(Buffer buf) {
|
|||||||
void drawIcon(int x, int y, Buffer buf, Draw mode) {
|
void drawIcon(int x, int y, Buffer buf, Draw mode) {
|
||||||
if (!isValidIcon(buf))
|
if (!isValidIcon(buf))
|
||||||
return;
|
return;
|
||||||
if (mode & Draw::Double)
|
if (mode & (Draw::Double | Draw::Quad)) {
|
||||||
buf = doubleIcon(buf);
|
buf = doubleIcon(buf);
|
||||||
|
if (mode & Draw::Quad) {
|
||||||
|
auto pbuf = buf;
|
||||||
|
buf = doubleIcon(buf);
|
||||||
|
decrRC(pbuf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int pixwidth = buf->data[1];
|
int pixwidth = buf->data[1];
|
||||||
int ptr = 2;
|
int ptr = 2;
|
||||||
|
@ -94,7 +94,7 @@ namespace screen {
|
|||||||
let byteWidth = (currFont.charWidth + 7) >> 3
|
let byteWidth = (currFont.charWidth + 7) >> 3
|
||||||
let charSize = byteWidth * currFont.charHeight
|
let charSize = byteWidth * currFont.charHeight
|
||||||
let iconBuf = output.createBuffer(2 + charSize)
|
let iconBuf = output.createBuffer(2 + charSize)
|
||||||
let double = (mode & Draw.Double) ? 2 : 1
|
let double = (mode & Draw.Quad) ? 4 : (mode & Draw.Double) ? 2 : 1
|
||||||
iconBuf[0] = 0xf0
|
iconBuf[0] = 0xf0
|
||||||
iconBuf[1] = currFont.charWidth
|
iconBuf[1] = currFont.charWidth
|
||||||
while (cp < text.length) {
|
while (cp < text.length) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
screen.clear()
|
screen.clear()
|
||||||
screen.drawText(10, 30, "Welcome PXT!", Draw.Double)
|
screen.drawText(10, 30, "PXT!", Draw.Quad)
|
||||||
|
|
||||||
screen.drawRect(40, 40, 20, 10, Draw.Fill)
|
screen.drawRect(40, 40, 20, 10, Draw.Fill)
|
||||||
output.setLights(LightsPattern.Orange)
|
output.setLights(LightsPattern.Orange)
|
||||||
|
Loading…
Reference in New Issue
Block a user