Author Topic: Updating only one object on screen  (Read 3164 times)

0 Members and 1 Guest are viewing this topic.

Offline ingalls

  • LV3 Member (Next: 100)
  • ***
  • Posts: 49
  • Rating: +4/-0
  • :)
    • View Profile
Updating only one object on screen
« on: May 01, 2011, 06:34:53 pm »
Is there anyway to update a specific object on the screen instead of the entire screen. I've been wrangling with this one for most of the day and haven't been able to figure it out!

Cheers
Ingalls

EDIT: basically the problem I'm having is that I'm trying to fill up the whole screen with tiles for a game. The lua engine currently has to pause to be able to draw the tiles. Whenever I move the character tile, it has to redraw the whole screen just to move a single character tile. Is there anyway change the screen without completely refreshing it. Whenever on.paint(gc) is called it clears the screen and redraws...
« Last Edit: May 01, 2011, 07:42:47 pm by ingalls »

Offline ingalls

  • LV3 Member (Next: 100)
  • ***
  • Posts: 49
  • Rating: +4/-0
  • :)
    • View Profile
Updating only one object on screen
« Reply #1 on: May 01, 2011, 08:16:49 pm »
Quote
while(Exit)
   ------- Some OS routines here

    ---- Begin of Event link
   buffer:captureDataFromKeyPad()            --  (N) some underground routines to catch events
   if buffer.charInput ~= "" then            --  (N)
      on.charIn(buffer.charInput)
      buffer.charInput= ""            --  (N)
   end
   if buffer.arrowKey ~= "" then            --  (N)
      on.arrowKey(buffer.arrowKey)
      buffer.arrowKey = ""            --  (N)
   end
   ----- etc ...    
   if platform.window.isInvalidate then
       platform.gc():purge()           --  (N) Empty buffer before starting to draw
      on.paint(platform.gc())         -- save all the things we have to draw
       platform:paint()             --  (N) draw all those things
      platform.window.isInvalidate = false    -- say that the window has been drawn
   end
   ----- End of Event link
end

This is taken from hackspire, just to clarify what I'm asking. I'm looking to find a way to stop the :purge() from happening. I want to be able to add to the drawing after the window  has been drawn.

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Updating only one object on screen
« Reply #2 on: May 02, 2011, 07:11:11 am »
Sadly enough, TI chose to implement the graphic engine buffer-based (as a stack), so you have to chose what to put in the stack, and the on.paint(gc) will redraw the buffer each time it gets called, and so, there is no way to only refresh one thing at a time ... :(
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline ingalls

  • LV3 Member (Next: 100)
  • ***
  • Posts: 49
  • Rating: +4/-0
  • :)
    • View Profile
Re: Updating only one object on screen
« Reply #3 on: May 03, 2011, 05:46:03 pm »
They give us a decent language to program in but restrict it so much to make it almost impossible to program games whose graphics take up the whole screen... *Sigh*

Anyways, that's nice to know, thanks for the response, I won't spend my time tearing out my hair trying to firgure it out

Cheers
Ingalls