Unified · Split
| @@ -38,16 +38,15 @@ struct Sfont { · 37 unmodified lines | |||
| 38 | 38 | ||
| 39 | static Sfont fo; | 39 | static Sfont fo; |
| 40 | static Image *image; | 40 | static Image *image; |
| 41 | static int invert = 0; | ||
| 41 | int mainstacksize = 32768; | 42 | int mainstacksize = 32768; |
| 42 | 43 | ||
| 43 | static void | 44 | static void |
| 44 | redraw(void) | 45 | redraw(void) |
| 45 | { | 46 | { |
| 46 | lockdisplay(display); | 47 | lockdisplay(display); |
| 47 | draw(screen, screen->r, display->white, nil, ZP); | 48 | draw(screen, screen->r, invert ? display->black : display->white, nil, ZP); |
| 48 | |||
| 49 | draw(screen, screen->r, image, nil, ZP); | 49 | draw(screen, screen->r, image, nil, ZP); |
| 50 | |||
| 51 | flushimage(display, 1); | 50 | flushimage(display, 1); |
| 52 | unlockdisplay(display); | 51 | unlockdisplay(display); |
| 53 | } | 52 | } |
| @@ -161,8 +160,10 @@ prepare(float height, char *s) · 107 unmodified lines | |||
| 161 | 160 | ||
| 162 | freeimage(image); | 161 | freeimage(image); |
| 163 | image = allocimage(display, rect, GREY8, 0, DNofill); | 162 | image = allocimage(display, rect, GREY8, 0, DNofill); |
| 164 | for(i = 0; i < w*h+60; i++) | 163 | if(!invert){ |
| 165 | p[i] = 255 - p[i]; | 164 | for(i = 0; i < w*h+60; i++) |
| 165 | p[i] = 255 - p[i]; | ||
| 166 | } | ||
| 166 | loadimage(image, rect, p, n); | 167 | loadimage(image, rect, p, n); |
| 167 | free(p); | 168 | free(p); |
| 168 | } | 169 | } |
| @@ -208,10 +209,11 @@ threadmain(int argc, char **argv) · 39 unmodified lines | |||
| 208 | a[2].c = kctl->c; | 209 | a[2].c = kctl->c; |
| 209 | memimageinit(); | 210 | memimageinit(); |
| 210 | height = 32.0; | 211 | height = 32.0; |
| 212 | oldy = 0; | ||
| 211 | 213 | ||
| 212 | for(;;){ | 214 | for(;;){ |
| 213 | oldb = m.buttons; | 215 | oldb = m.buttons; |
| 214 | prepare(height, "Hello there, 9fans. ljil|."); | 216 | prepare(height, argc > 2 ? argv[2] : "Hello there, 9fans. ljil|."); |
| 215 | redraw(); | 217 | redraw(); |
| 216 | 218 | ||
| 217 | switch(alt(a)){ | 219 | switch(alt(a)){ |
| @@ -219,9 +221,11 @@ threadmain(int argc, char **argv) · 1 unmodified line | |||
| 219 | if(m.buttons == 1){ | 221 | if(m.buttons == 1){ |
| 220 | if(oldb == 0) | 222 | if(oldb == 0) |
| 221 | oldy = m.xy.y; | 223 | oldy = m.xy.y; |
| 222 | height += (m.xy.y - oldy)/10.0; | 224 | else{ |
| 223 | if(height < 4) | 225 | height += (m.xy.y - oldy)/10.0; |
| 224 | height = 4; | 226 | if(height < 4) |
| 227 | height = 4; | ||
| 228 | } | ||
| 225 | } | 229 | } |
| 226 | break; | 230 | break; |
| 227 | 231 | ||
| @@ -241,6 +245,9 @@ threadmain(int argc, char **argv) · 13 unmodified lines | |||
| 241 | case '+': | 245 | case '+': |
| 242 | height += 2; | 246 | height += 2; |
| 243 | break; | 247 | break; |
| 248 | case 'i': | ||
| 249 | invert = !invert; | ||
| 250 | break; | ||
| 244 | } | 251 | } |
| 245 | } | 252 | } |
| 246 | } | 253 | } |