forked from wheremyfoodat/Panda3DS
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* - Fix MainActivity.java crash on start. - Separate MainActivity.java into two Classes: MainActivity.java and GameActivity - Implement post callback in GLRenderer. * .
- Loading branch information
1 parent
377c4b3
commit fea8862
Showing
11 changed files
with
123 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
src/pandroid/app/src/main/java/com/panda3ds/pandroid/PandaGlSurfaceView.java
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/BaseActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.panda3ds.pandroid.app; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
public class BaseActivity extends AppCompatActivity { | ||
} |
32 changes: 32 additions & 0 deletions
32
src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/GameActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.panda3ds.pandroid.app; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.widget.FrameLayout; | ||
import android.widget.Toast; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
import com.panda3ds.pandroid.utils.Constants; | ||
import com.panda3ds.pandroid.view.PandaGlSurfaceView; | ||
|
||
public class GameActivity extends BaseActivity { | ||
private PandaGlSurfaceView pandaSurface; | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
Intent intent = getIntent(); | ||
if(!intent.hasExtra(Constants.EXTRA_PATH)){ | ||
|
||
setContentView(new FrameLayout(this)); | ||
Toast.makeText(this, "INVALID ROM PATH", Toast.LENGTH_LONG).show(); | ||
finish(); | ||
return; | ||
} | ||
|
||
pandaSurface = new PandaGlSurfaceView(this, intent.getStringExtra(Constants.EXTRA_PATH));; | ||
setContentView(pandaSurface); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/pandroid/app/src/main/java/com/panda3ds/pandroid/utils/Constants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.panda3ds.pandroid.utils; | ||
|
||
public class Constants { | ||
public static final String EXTRA_PATH = "path"; | ||
public static final String LOG_TAG = "Alber"; | ||
} |
2 changes: 1 addition & 1 deletion
2
...java/com/panda3ds/pandroid/PathUtils.java → ...om/panda3ds/pandroid/utils/PathUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/pandroid/app/src/main/java/com/panda3ds/pandroid/view/PandaGlSurfaceView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.panda3ds.pandroid.view; | ||
|
||
import android.content.Context; | ||
import android.opengl.GLSurfaceView; | ||
|
||
public class PandaGlSurfaceView extends GLSurfaceView { | ||
final PandaGlRenderer renderer; | ||
|
||
public PandaGlSurfaceView(Context context, String romPath) { | ||
super(context); | ||
setEGLContextClientVersion(3); | ||
setDebugFlags(DEBUG_LOG_GL_CALLS); | ||
renderer = new PandaGlRenderer(romPath); | ||
setRenderer(renderer); | ||
} | ||
|
||
public PandaGlRenderer getRenderer() { | ||
return renderer; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
<FrameLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".MainActivity"> | ||
tools:context=".app.MainActivity"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Hello World!" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:gravity="bottom|end" | ||
android:padding="17dp"> | ||
<Button | ||
android:id="@+id/load_rom" | ||
android:layout_width="wrap_content" | ||
android:layout_height="50dp" | ||
android:text="@string/load_rom"/> | ||
</LinearLayout> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
</FrameLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<resources> | ||
<string name="app_name">pandroid</string> | ||
<string name="load_rom">Load ROM</string> | ||
</resources> |