Improve pointer speed
Press and hold for half a second to make the pointer go fast. Closes issue #26. Signed-off-by: Mahyar Koshkouei <deltabeard@users.noreply.github.com>
This commit is contained in:
@@ -76,40 +76,33 @@ int main(int argc, char **argv)
|
|||||||
printf("\rNum: %d, Max: %d, from: %d ", fileNum, fileMax, from);
|
printf("\rNum: %d, Max: %d, from: %d ", fileNum, fileMax, from);
|
||||||
consoleSelect(&bottomScreen);
|
consoleSelect(&bottomScreen);
|
||||||
#endif
|
#endif
|
||||||
|
if(kDown)
|
||||||
|
mill = osGetTime();
|
||||||
|
|
||||||
if((kHeld & KEY_UP) && fileNum > 0 && fileNum > 0)
|
if((kDown & KEY_UP || ((kHeld & KEY_UP) &&
|
||||||
|
osGetTime() - mill > 500)) &&
|
||||||
|
fileNum > 0 && fileNum > 0)
|
||||||
{
|
{
|
||||||
/* Limit the speed of the selector */
|
|
||||||
if(osGetTime() - mill < 100)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
fileNum--;
|
fileNum--;
|
||||||
|
|
||||||
/* 26 is the maximum number of entries that can be printed */
|
/* 26 is the maximum number of entries that can be printed */
|
||||||
if(fileMax - fileNum > 26 && from != 0)
|
if(fileMax - fileNum > 26 && from != 0)
|
||||||
from--;
|
from--;
|
||||||
|
|
||||||
mill = osGetTime();
|
|
||||||
|
|
||||||
consoleClear();
|
|
||||||
if(listDir(from, MAX_LIST, fileNum) < 0)
|
if(listDir(from, MAX_LIST, fileNum) < 0)
|
||||||
err_print("Unable to list directory.");
|
err_print("Unable to list directory.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if((kHeld & KEY_DOWN) && fileNum < fileMax && fileNum < fileMax)
|
if((kDown & KEY_DOWN || ((kHeld & KEY_DOWN) &&
|
||||||
|
osGetTime() - mill > 500)) &&
|
||||||
|
fileNum < fileMax && fileNum < fileMax)
|
||||||
{
|
{
|
||||||
if(osGetTime() - mill < 100)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
fileNum++;
|
fileNum++;
|
||||||
|
|
||||||
if(fileNum >= MAX_LIST && fileMax - fileNum >= 0 &&
|
if(fileNum >= MAX_LIST && fileMax - fileNum >= 0 &&
|
||||||
from < fileMax - MAX_LIST)
|
from < fileMax - MAX_LIST)
|
||||||
from++;
|
from++;
|
||||||
|
|
||||||
mill = osGetTime();
|
|
||||||
|
|
||||||
consoleClear();
|
|
||||||
if(listDir(from, MAX_LIST, fileNum) < 0)
|
if(listDir(from, MAX_LIST, fileNum) < 0)
|
||||||
err_print("Unable to list directory.");
|
err_print("Unable to list directory.");
|
||||||
}
|
}
|
||||||
@@ -128,7 +121,6 @@ int main(int argc, char **argv)
|
|||||||
from = 0;
|
from = 0;
|
||||||
fileMax = getNumberFiles();
|
fileMax = getNumberFiles();
|
||||||
|
|
||||||
consoleClear();
|
|
||||||
if(listDir(from, MAX_LIST, fileNum) < 0)
|
if(listDir(from, MAX_LIST, fileNum) < 0)
|
||||||
err_print("Unable to list directory.");
|
err_print("Unable to list directory.");
|
||||||
|
|
||||||
@@ -170,7 +162,6 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
fileNum = 0;
|
fileNum = 0;
|
||||||
from = 0;
|
from = 0;
|
||||||
consoleClear();
|
|
||||||
fileMax = getNumberFiles();
|
fileMax = getNumberFiles();
|
||||||
if(listDir(from, MAX_LIST, fileNum) < 0)
|
if(listDir(from, MAX_LIST, fileNum) < 0)
|
||||||
err_print("Unable to list directory.");
|
err_print("Unable to list directory.");
|
||||||
@@ -251,6 +242,7 @@ int listDir(int from, int max, int select)
|
|||||||
if(wd == NULL)
|
if(wd == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
consoleClear();
|
||||||
printf("Dir: %.33s\n", wd);
|
printf("Dir: %.33s\n", wd);
|
||||||
|
|
||||||
if((dp = opendir(wd)) == NULL)
|
if((dp = opendir(wd)) == NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user