iOS Question Acelerated Graphics

Discussion in 'iOS Questions' started by Alejandro Migoya, Jun 11, 2015.

  1. Alejandro Migoya

    Alejandro Migoya Member Licensed User

    I´m working on a project where there is an extensive use of Canvas, DrawBitmap, DrawCircles, etc...

    Do you have any sugestions to acelerate my code?

    Maybe a declaration to let my code know I´ll be using hardware acelerated graphics or something?
    Or any especific functions that are known to slow down code?

    Thanks! Any help will be very appreciated

    Alex
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Is the current code too slow? Can you post it?
     
  3. Alejandro Migoya

    Alejandro Migoya Member Licensed User

    The code is performing well, I´ve optimized it as far as I can, but I´m concerned about it running on older devices (currently testing on iPhone 6)

    I have a timer with a refresh rate every 30 milliseconds, and the processing time for each loop is currently about 20 milliseconds, so we are good so far, but can´t add that many more functions to the loop before it starts exceding the timer interval.

    I can´t post the code because it would mean posting the whole project...

    I was just wondering if I was missing something escential like a graphics aceleration declaration or something.
    The code uses many transparencies, fills, shapes, bitmaps, etc. over a canvas.

    I´m concerned that maybe I´m using some function that is slowing everything down. For example, I found out that the gradient fill function on a canvas is very slow... stopped using.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    I see. There is no "hardware acceleration" flag in iOS.
     
  5. Alejandro Migoya

    Alejandro Migoya Member Licensed User

    Thanks Erel
     
  6. Alejandro Migoya

    Alejandro Migoya Member Licensed User

    narek adonts likes this.
  7. narek adonts

    narek adonts Well-Known Member Licensed User

    I think it is better to use CADisplayLink instead of a timer as it tick on each screen refresh by OS instead of an interval set manually.
     
  8. Alejandro Migoya

    Alejandro Migoya Member Licensed User

    but wouldn´t it change the game speed depending on each device screen refresh rate?
    (or do all iphones and ipads have the same screen frequency?)
     
  9. narek adonts

    narek adonts Well-Known Member Licensed User

    there is a timestamp property which you can use to calculate the speed, etc.

    But on my iPhone 5S your game was smooth, so I think it is ok now)
     
  10. Alejandro Migoya

    Alejandro Migoya Member Licensed User

    Interesting, thanks Narek, I´ll keep your advice in mind.
     
Loading...