Menu

ili xor

2022-02-28
2022-03-01
  • stan cartwright

    stan cartwright - 2022-02-28
     
  • stan cartwright

    stan cartwright - 2022-02-28

    Hi Evan. I've been thinking about games and graphics.
    Your work on ili9341 is great with find pixel colour and the sprite demo for lgt328 is a lot of new ways to send data... must use it. Any way , can sprites be xored with ili9341? Think of pacman and what is involved.
    In you sprite demo you send a block of zeros to erase the sprite.
    from gcstudio

        sub erase_sprite (sprite_x,sprite_y) ;write a box of 0's
          SetAddressWindow_ILI9341 ( sprite_x,sprite_y,sprite_x +15,sprite_y +15 )
    
          #IFDEF ILI9341_HardwareSPI
              set ILI9341_CS OFF
              set ILI9341_DC ON
    
              repeat 128
                repeat 2
                    FastHWSPITransfer bg_hi
                    FastHWSPITransfer bg_lo
                end repeat
              end repeat
          #ENDIF
    
          #IFNDEF ILI9341_HardwareSPI
              repeat 256
                SendWord_ILI9341 bg
              end repeat
          #ENDIF
    
        end sub
    

    What would be the fastest way to read a block of screen and xor the colours?
    ie draw summat then redraw with xor to erase and it don't erase background... I think.
    Works in black and white.
    Any advice welcome.

     
  • stan cartwright

    stan cartwright - 2022-02-28

    I'll look at glcd ...again , and see . I don't care if it doesn't work on other displays.
    The idea that gcb works on everything is not viable.
    I don't see why not get the most out of one device even it won't work on other devices.
    This device has pixel read and touch working. You have showed faster graphics functions.
    It should be the recommended display for pic/avr imho. Doing graphics improves programming skills.. well you type more stuff. Animated graphics are fun but the actual programming can be difficult as you want speed to get the animated part to look nice.
    Thing is I want graphics to go over other graphics and not erase them so xor seemed simplest but the colours are difficult. Help! please

     
  • Anobium

    Anobium - 2022-02-28

    There is a seriously good video on gaming on YouTube. https://www.youtube.com/watch?v=TPbroUDHG0s&ab_channel=StrangeLoopConference This conference tells you how they really did it.

    I would use some of the same techniques - hold the map in tables, and then write the sprite and
    restore the map when the sprite moves. It may be faster then XORing colours.


    Looking at your Sub.. not sure why you are send 256 words

     
    • stan cartwright

      stan cartwright - 2022-03-01

      Looking at your Sub.. not sure why you are send 256 words.
      It's your code Anobium for LGT328 showing how fast they work. It improves on my original sprite code.
      When trying gcstudio I looked at old files and found one that used ili_read_pixel and seems I wrote some loops to copy the background with intentions of restoring it. I can't remember writing it. Some old games like Galaxians would be easy but other games that look simple, Pacman being a good example, are in fact quite complicated not just the logic but implementing the graphics.
      The ghosts move around without rubbing out the pills.

      For faster sprites if they move only 1 or 2 pixels is to put a background border around them so instead of draw-erase-draw it would be draw-draw -draw and the sprite in new position would erase old sprite.

      Anyway back to xor. I guess it would be reading the pixel off the display then xoring it with the pixel to be sent then sending it. Seems complicated. Thanks for the links.

      I've been inpired by retropi and all those old games. I've even found games I wrote...
      so ashamed :(
      6K of screen memory directly accessed and this was the best I could do. Someone made a youtube video. https://www.youtube.com/watch?v=yCqjwRdbBD0

      ps... you seen this before https://www.youtube.com/watch?v=oE_YZH8jow0

       

      Last edit: stan cartwright 2022-03-01

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.