Closed josdorrod closed 3 months ago
Thank you for contributing! I will definitely look into it. But as you have made it system specific. Could try making it universal. Have any idea ?
I could try to test on Windows. I am not sure but I think that on macOS and Linux the behaviour is the same.
Test It and let me know your opinion. Then i Will try to do the same for windows
Okei sure.. I would look into it by tomorrow
I creaked ur code works in linux fine.. But in windows its not working.. I have been also stuck in this problem trying to figure out a universal code independent of os.
Is it valid if I look for an alternative to make it work for Windows and another for Linux? Then using variable in C we will know which OS is being used and take one path or another
Yes sure that would work ...
Take a look at the below code.. We could use #if #ellif preprocessor execution statement to find out about the os
#if defined(_WIN32) || defined(_WIN64)
printf("Operating System: Windows\n");
#elif defined(__APPLE__) && defined(__MACH__)
printf("Operating System: macOS\n");
#elif defined(__linux__)
printf("Operating System: Linux\n");
#elif defined(__unix__)
printf("Operating System: Unix\n");
#else
printf("Operating System: Unknown\n");
#endif
Kind of like this you can use it in algorithm.h function to determine the os and accordingly we can map the arrow keys to ASWD keys in algorithm.c
Okk.. give me 1 day time I will take a look at it by tomorrow
I add key recognisition for windows (without having to push enter) and for unix system (pushing enter) add .gitignore Add getkey.c and getkey.h Modified Cmake Tested on windows and linux. Let me know your opinion
I'll review all the points you've made
The logical part that you have written is correct. But when we are pressing the arrow key for a little long its shifting all the number in that directing and ending the game.
What we need to do is wait until the user stops pressing the arrow key and then return the character.
ex.. if we press arrow (left) for 5sec the program waits till i release the arrow key press.. and then it just retunes character 'a'...
Have you committed all the changes yet ?...Because I tried running and its not working.
Clicking on arrow key its not moving the Numbers. Clicking on arrow key its generating some random character
Add minor change commented. Add waiting key release on get_key_window. Add validation to only take the first 4 characters on get_key. Change system(cls) for new function that use cls or clear depending on the system.
Great work.. Works good in windows i cheeked. Have you cheeked in Linux os ? Unfortunately for some reason my virtual engine turned off i am not able to use (Linux) right now.
So It is working correctly?Yeah, I checked on Linux but I have to press enter after each key. There is a way to do without pressing enter but you have to change the Shell properties and i didn't want to risk.El 7 jul 2024 21:36, nomad2036 @.***> escribió: Great work.. Works good in windows i cheeked. Have you cheeked in Linux os ? Unfortunately for some reason my virtual engine turned off i am not able to use (Linux) right now.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
Ok no prob.. I am merging it to the main branch
Possibility of using arrows keys or asdw. Modified number of movements. Alphabetical arrangement of headers.