Hi

I am experiencing severe fps dropping(20-30) in a game im trying to
develop in order to get to know android.
I  have a surfaceView which I extended, this has a game thread that
does the rendering via the canvas. In the same activity i have a
LinearLayout with four ImagesViews inside which i use to register the
button presses. If i do not press anything on the screen the app runs
at 55-60 fps. As soon as I touch one of the "buttons" (ImageViews) i
pass this button click to the game thread which then does the rest.

Thus i have a severe fps drop as soon as I touch the screen to click
the "buttons". I have tried overriding the onTouchEvent and doing a
Thread.sleep(120) in the main activity This doesnt seem to help. the
only other method that helps is overriding the dispatchTouchEvent() in
which i also do a Thread.sleep(120), this does stop the frames drop,
but now no events reach the imageView listeners.

As a noob (i come from AS3 :) Im not entirely sure if having other
views in the same activity to register clicks is the best way of doing
this type of game.

Please help, I have read up but alas nothing helps.

this is my layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
        android:orientation="vertical" android:layout_width="fill_parent"
        android:layout_height="fill_parent">



        <com.swat.android.views.GameView
                android:id="@+id/game" android:layout_width="fill_parent"
                android:layout_height="320dip" />

        <LinearLayout android:id="@+id/bottomrow"
                android:orientation="horizontal" 
android:layout_width="fill_parent"
android:background="@drawable/background_bottom"
                android:layout_height="wrap_content" android:gravity="bottom|
center_horizontal">

                <ImageView android:id="@+id/leftButton"
android:layout_width="wrap_content"
                        android:layout_height="wrap_content" android:text="left"
android:src="@drawable/left_button" />
                <ImageView android:id="@+id/upButton"
android:layout_width="wrap_content"
                        android:layout_height="wrap_content" android:text="top"
android:src="@drawable/up_button" />
                <ImageView android:id="@+id/downButton"
android:layout_width="wrap_content"
                        android:layout_height="wrap_content" android:text="down"
android:src="@drawable/down_button"/>
                <ImageView android:id="@+id/rightButton"
android:layout_width="wrap_content"
                        android:layout_height="wrap_content" 
android:text="right"
android:src="@drawable/right_button" />
        </LinearLayout>


</LinearLayout>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to