Esempio n. 1
0
File: peter.c Progetto: arsenm/glfw
static void key_callback(GLFWwindow window, int key, int action)
{
    switch (key)
    {
        case GLFW_KEY_SPACE:
        {
            if (action == GLFW_PRESS)
                toggle_cursor(window);

            break;
        }

        case GLFW_KEY_R:
        {
            if (action == GLFW_PRESS)
                reopen = GL_TRUE;

            break;
        }
    }
}
Esempio n. 2
0
void main() {
    int x, y, c;
    struct timer_wait tw;
    int led_status = LOW;

    // Default screen resolution (set in config.txt or auto-detected)
    //fb_init(0, 0);

    // Sets a specific screen resolution
    fb_init(32 + 320 + 32, 32 + 200 + 32);

    fb_fill_rectangle(0, 0, fb_width - 1, fb_height - 1, BORDER_COLOR);

    initscr(40, 25);
    cur_fore = WHITE;
    cur_back = BACKGROUND_COLOR;
    clear();

    mvaddstr(1, 9, "**** RASPBERRY-PI ****");
    mvaddstr(3, 7, "BARE-METAL SYSTEM TEMPLATE\r\n");

    if (mount("sd:") != 0) {
        addstrf("\r\nSD CARD NOT MOUNTED (%s)\r\n", strerror(errno));
    }

    usb_init();
    if (keyboard_init() != 0) {
        addstr("\r\nNO KEYBOARD DETECTED\r\n");
    }

    pinMode(16, OUTPUT);
    register_timer(&tw, 250000);

    addstr("\r\nREADY\r\n");

    while(1) {
        if ((c = getch()) != -1) {
            switch(c) {
                case KEY_UP:
                    getyx(y, x);
                    move(y - 1, x);
                    break;
                case KEY_DOWN:
                    getyx(y, x);
                    move(y + 1, x);
                    break;
                case KEY_LEFT:
                    getyx(y, x);
                    x--;
                    if (x < 0) {
                        x = 39;
                        y--;
                    }
                    move(y, x);
                    break;
                case KEY_RIGHT:
                    getyx(y, x);
                    x++;
                    if (x >= 40) {
                        x = 0;
                        y++;
                    }
                    move(y, x);
                    break;
                case KEY_HOME:
                    getyx(y, x);
                    move(y, 0);
                    break;
                case KEY_PGUP:
                    move(0, 0);
                    break;
                case '\r':
                    addch(c);
                    addch('\n');
                    break;
                default:
                    if (c < 0x7F) {
                        addch(c);
                    }
                    break;
            }
        }

        if (compare_timer(&tw)) {
            led_status = led_status == LOW ? HIGH : LOW;
            digitalWrite(16, led_status);
            toggle_cursor();
        }

        refresh();
    }
}
Esempio n. 3
0
void term::hide_cursor ()
{
  if (_cursor_visible)
    toggle_cursor ();
}
Esempio n. 4
0
void term::show_cursor ()
{
  if (!_cursor_visible)
    toggle_cursor ();
}