Timeline for First C program: records keyboard/mouse and simulates the recording afterwards
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 8, 2019 at 23:34 | comment | added | chux |
@weno Use a single linked list. Carefully detail why you think you need a double linked list. Chances are, in the end a single linked one will do. A single linked list can perform all these in O(1) time: Add_to_front(), Add_to_end(), Take_from_front(), report_front(), report_end(), Walk_list__forward_step() .
|
|
May 8, 2019 at 12:06 | comment | added | weno |
Real question is what should I choose: doubly linked list (more memory because two pointers for each node) or singly linked list (less memory, but requires calling some reverse_list() function). With singly linked list it could work like that: keep adding to the start, then reverse_list() , then play from the start.
|
|
May 8, 2019 at 12:06 | comment | added | weno |
Not sure about play_recording() part. I am intentionally adding at the start of the queue and then playing from the end-to-start. I guess because it is a doubly linked list I can also quickly keep adding to the tail instead of start, and then play from the start. Yeah makes it more clear I guess.
|
|
May 8, 2019 at 12:03 | comment | added | weno |
Thank you for feedback. add_cursor() does indeed add cursor if and only if cursor has moved. With an exception for initial cursor position: it is added. I have recorded a short video to demonstrate that: streamable.com/1roos Problem is there was a small bug you helped me discover: if cursor initial possition is (0, 0) , then the program would crash. I have fixed it by initializing POINT array with -1 instead of 0 .
|
|
May 8, 2019 at 2:19 | history | edited | chux | CC BY-SA 4.0 |
added 147 characters in body
|
May 8, 2019 at 2:14 | history | edited | chux | CC BY-SA 4.0 |
added 147 characters in body
|
May 8, 2019 at 2:07 | history | answered | chux | CC BY-SA 4.0 |