B4i Library iGameView - Library for games

Discussion in 'iOS Libraries' started by Erel, Sep 6, 2016.

  1. Erel

    Erel Administrator Staff Member Licensed User

    iGameView is a port of B4A GameView library: https://www.b4x.com/android/forum/threads/gameview-create-2d-android-games-part-i.20038/

    It also includes methods for low latency audio playback, similar to B4A SoundPool. These features are based on the following open source project: https://github.com/kstenerud/ObjectAL-for-iPhone (see the license in the readme).

    You can use the audio playback features without the GameView drawing features.

    Three examples are included:

    GameViewSmiley: simple example with no interaction


    Jumping smiley: vertical scrolling game where the user controls the smiley by tilting the phone.

    Asteroids: classic asteroids example. This also includes a game pad class.

    You should start by going over the B4A tutorials. The main concepts are the same.

    Tips & notes

    - The B4A examples use %x / %y for most measurements. In B4i you should only use percentage inside Page_Resize event. As an alternative we handle the Page1_Resize event once and store the page width and height. Note that all of the layout is set in the first resize event.
    - B4i Rect object stores the values as floats while B4A Rect object stores the values as Ints. You can use Round to round the values before they are set.
    - Performance should be tested in release mode (Alt + T + B + R).
    If it starts to be very slow in debug mode then stop the program, click on Ctrl + P (clean project) and run again.
    The performance in release mode should be good. It can handle several hundred sprites.

    - You will see in the examples that I'm using this sub to create canvas objects:
    'don't forget to release when done
    Public Sub CreateCanvas (width1 As Int, height1 As Int) As Canvas
    Dim iv As ImageView
    0100, width1, height1)
    Dim c As Canvas
    Return c
    End Sub
    This is an alternative to B4A Bitmap.InitializeMutable method.

    If you are using the hosted builder then only the XML file is required.

    Attached Files:

    Last edited: Jun 6, 2018
    Ohanian, JordiCP, ilan and 4 others like this.
  2. Mark Turney

    Mark Turney Active Member Licensed User

    Woohoo!! Thanks as always Erel!!
  3. sorex

    sorex Expert Licensed User

    does this contain any acceleration or is everything on IOS accelerated anyway?
  4. Erel

    Erel Administrator Staff Member Licensed User

    The sprites are based on ImageViews. The handling of views is hardware accelerated. The performance is similar to B4A GameView performance. It can handle several hundred sprites.
    Mark Turney likes this.
  5. ilan

    ilan Expert Licensed User

    Perfect erel, thanx a lot!
  6. sorex

    sorex Expert Licensed User

    When I try my project that ran fine on my IOS9 device at work on my IOS7 device at home I get an immediate crash without any info in the log window.

    Is iGameView also requiring IOS9 or better like iSpritekit does (also crashes) ?
  7. Erel

    Erel Administrator Staff Member Licensed User

    Does it happen if you disable the audio playback?
  8. sorex

    sorex Expert Licensed User

    The phone is at home so I can only test things tonight.

    I didn't disabled it myself so it's probably still on.

    It also turns out it's an iphone 4 and nothe 4S I thought it was so I'm stuck on 7.1.2 or something.
    I have a 5 or 5S at home aswell but I don't know on what it is running will verify it on that one aswell.
  9. sorex

    sorex Expert Licensed User

    now it's working fine. without touching the source.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice