Date:2012-06-21 23:48:54 (7 years 7 months ago)
Author:Werner Almesberger
Commit:87050bc12a828065e779d44f03fdf7e45accc8d3
Message:tools/: exit from sample mode by pressing Q or by closing the window

Files: tools/antorcha.c (1 diff)
tools/plot.c (3 diffs)
tools/plot.h (1 diff)

Change Details

tools/antorcha.c
315315            y |= *s++ << 8;
316316            if (debug)
317317                fprintf(stderr, "\t%d %d\n", x, y);
318            plot(x, y);
318            if (!plot(x, y))
319                goto quit;
319320        }
320321    }
322quit:
321323    buf[0] = 0;
322324    packet(dsc, SAMPLE, 0, 0, buf, PAYLOAD);
323325}
tools/plot.c
1616#include "SDL.h"
1717#include "SDL_gfxPrimitives.h"
1818
19#include "plot.h"
20
1921
2022#define XRES 1024
2123#define YRES 1024
...... 
4446};
4547
4648
47void plot(int x, int y)
49int plot(int x, int y)
4850{
51    SDL_Event event;
52
4953    if (!first) {
5054        SDL_BlitSurface(back, &back_rect, surf, &front_rect);
5155        SDL_LockSurface(surf);
...... 
7175    first = 0;
7276    last_x = x;
7377    last_y = y;
78
79    while (SDL_PollEvent(&event))
80        switch (event.type) {
81        case SDL_KEYDOWN:
82            switch (event.key.keysym.sym) {
83            case SDLK_q:
84                return 0;
85            default:
86                break;
87            }
88            break;
89        case SDL_QUIT:
90            return 0;
91        default:
92            break;
93        }
94
95    return 1;
7496}
7597
7698
tools/plot.h
1414#ifndef PLOT_H
1515#define PLOT_H
1616
17void plot(int x, int y);
17int plot(int x, int y);
1818void plot_init(void);
1919
2020#endif /* !PLOT_H */

Archive Download the corresponding diff file

Branches:
master
tornado-v1



interactive