LibreWands/Source/playJoycon.c

67 lines
1.4 KiB
C

// This file is part of LibreWands.
// LibreWands is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
// LibreWands is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along with LibreWands. If not, see https://www.gnu.org/licenses/.
#include "engineCore.c"
#include <ncurses.h>
int main()
{
initEngine();
int a = 0;
for (int k = 0;; k = joycon())
{
switch (k)
{
case 'w':
a = 0;
clear();
break;
case 's':
a = 1;
clear();
break;
case 'a':
a = 2;
clear();
break;
case 'd':
a = 3;
clear();
break;
case 'z':
a = 4;
clear();
break;
case 'x':
a = 5;
clear();
break;
case '\\':
a = 6;
clear();
break;
case '\n':
a = 7;
clear();
break;
}
mvprintw(0, 2, "UP");
mvprintw(1, 2, "DOWN");
mvprintw(2, 2, "LEFT");
mvprintw(3, 2, "RIGHT");
mvprintw(4, 2, "A");
mvprintw(5, 2, "B");
mvprintw(6, 2, "SELECT");
mvprintw(7, 2, "START");
mvprintw(a, 0, ">");
refresh();
}
endwin();
}