Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pm:prj2025:iivasciuc:marina.oprea2302 [2025/05/20 23:05]
marina.oprea2302 [Game flow]
pm:prj2025:iivasciuc:marina.oprea2302 [2025/05/21 09:09] (current)
marina.oprea2302 [Results]
Line 133: Line 133:
 ---------------------------------- ----------------------------------
 -> The ''​XPT2046''​ actually does not return pixel coordinates of touch. \\ -> The ''​XPT2046''​ actually does not return pixel coordinates of touch. \\
--> Thus remap was needed in order to get from a scale of (0, 4095) to screen pixel dimensions.+-> Thus remap using ''​map'' ​was needed in order to get from a scale of (0, 4095) to screen pixel dimensions
 +----------------------------------------- 
 +-> For a cleaner code, ''​Grid''​ class was implemented as a wrapper over a simple 4x4 matrix. \\ 
 +-> This way, overloaded ''​==''​ operator and copy constructor made saving states for undos and performing undo moves easier.
  
-==== User interaction ==== +---------------------------------------------- 
-User can choose to use touchscreen ​or joystick.+User can choose to use __touchscreen__ ​or __joystick__.
  
 In loop function, both variants are polled. Interruptions could not be used because ISR function would have been too complex. Thus I chose polling approach, taking into consideration that playing implies rather continuous moves. In loop function, both variants are polled. Interruptions could not be used because ISR function would have been too complex. Thus I chose polling approach, taking into consideration that playing implies rather continuous moves.
 +------------------------------------------------------------------
 +  * On menu changes, two flags are implied:
 +    * one that is set the first time the menu needs to be displayed
 +    * one that is set the whole time the menu is displayed
 +  * This implements __debouncing__ and also optimizes screen rendering operations.
  
-On menu changes, two flags are implied: + 
-  * one that is set the first time the menu needs to be displayed + 
-  * one that is set the whole time the menu is displayed +------------------------------------------- 
-This implements __debouncing__ and also optimizes screen rendering operations. +-> Information is not displayed ,on every frame'​. Thus, throughout the code I used to display different screens once and maintain them unchanged as much as possible. 
------------ +----------------------------------------- 
-Information is not displayed ,on every frame'​. Thus, throughout the code I used to display different screens once and maintain them unchanged as much as possible. +-> SPI protocol is fast, but clearing the whole screen and overwriting all pixels is by far visible with human eye. Thus animations that can be implemented cannot be too fast.
------------- +
-SPI protocol is fast, but clearing the whole screen and overwriting all pixels is by far visible with human eye. Thus animations that can be implemented cannot be too fast.+
  
 ==== Optimizations ==== ==== Optimizations ====
 -> As mentioned above, rerendering is avoided as much as possible. Thus, when screen changes, tile are rendered only if they have different value than before. \\ -> As mentioned above, rerendering is avoided as much as possible. Thus, when screen changes, tile are rendered only if they have different value than before. \\
--> When rendering tiles, color is chosen based on their value. In order to perform this efficiently,​ ILI9341 provided colors are stored in an array and bitwise dividing is used in order to find __idx = log2(val)__. +-> When rendering tiles, color is chosen based on their value. In order to perform this efficiently,​ ILI9341 provided colors are stored in an array and bitwise dividing is used in order to find __idx = log2(val)__. ​\\ 
 +-> ''​EEPROM.update''​ was used instead of ''​EEPROM.write''​ in order to preserve non-volatile memory lifetime.
 ==== Used labs ==== ==== Used labs ====
   * Lab0: GPIO   * Lab0: GPIO
Line 165: Line 171:
 ===== Results ===== ===== Results =====
 [[https://​github.com/​marinaoprea/​2048_Arduino_minigame|GitHub repository]] [[https://​github.com/​marinaoprea/​2048_Arduino_minigame|GitHub repository]]
 +
 +[[https://​drive.google.com/​file/​d/​1MYe3Vqu2S6hLiaHRXt_nY94sQPNRhBG9/​view?​usp=sharing | Demo video]]
  
 {{https://​drive.google.com/​file/​d/​1Xz-yoFstKYTesYOhvp8GsY_ydz1bZbdR/​view?​usp=sharing|Start screen image}} \\  {{https://​drive.google.com/​file/​d/​1Xz-yoFstKYTesYOhvp8GsY_ydz1bZbdR/​view?​usp=sharing|Start screen image}} \\ 
pm/prj2025/iivasciuc/marina.oprea2302.1747771520.txt.gz · Last modified: 2025/05/20 23:05 by marina.oprea2302
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0