-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9aded6e
commit 7c9d17f
Showing
13 changed files
with
349 additions
and
128 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
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
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
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
39 changes: 39 additions & 0 deletions
39
...id/app/src/main/java/com/panda3ds/pandroid/view/controller/nodes/TouchScreenNodeImpl.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,39 @@ | ||
package com.panda3ds.pandroid.view.controller.nodes; | ||
|
||
import android.graphics.Rect; | ||
import android.util.Log; | ||
import android.view.View; | ||
|
||
import com.panda3ds.pandroid.AlberDriver; | ||
import com.panda3ds.pandroid.R; | ||
import com.panda3ds.pandroid.utils.Constants; | ||
import com.panda3ds.pandroid.view.controller.ControllerNode; | ||
import com.panda3ds.pandroid.view.controller.TouchEvent; | ||
import com.panda3ds.pandroid.view.renderer.ConsoleRenderer; | ||
|
||
public interface TouchScreenNodeImpl extends ControllerNode { | ||
default void onTouchScreenPress(ConsoleRenderer renderer, TouchEvent event){ | ||
|
||
View me = (View) this; | ||
boolean hasDownEvent = me.getTag(R.id.TagEventHasDown) != null && (boolean) me.getTag(R.id.TagEventHasDown); | ||
|
||
Rect bounds = renderer.getLayout().getBottomDisplayBounds();; | ||
|
||
if (event.getX() >= bounds.left && event.getY() >= bounds.top && event.getX() <= bounds.right && event.getY() <= bounds.bottom){ | ||
int x = (int) (event.getX() - bounds.left); | ||
int y = (int) (event.getY() - bounds.top); | ||
|
||
x = Math.round((x/(float)bounds.width())*320); | ||
y = Math.round((y/(float)bounds.height())*240); | ||
|
||
AlberDriver.TouchScreenDown(x,y); | ||
|
||
me.setTag(R.id.TagEventHasDown, true); | ||
} | ||
|
||
if (hasDownEvent && event.getAction() == TouchEvent.ACTION_UP){ | ||
AlberDriver.TouchScreenUp(); | ||
me.setTag(R.id.TagEventHasDown, false); | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/pandroid/app/src/main/java/com/panda3ds/pandroid/view/renderer/ConsoleRenderer.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,9 @@ | ||
package com.panda3ds.pandroid.view.renderer; | ||
|
||
import com.panda3ds.pandroid.view.renderer.layout.ConsoleLayout; | ||
|
||
public interface ConsoleRenderer { | ||
void setLayout(ConsoleLayout layout); | ||
ConsoleLayout getLayout(); | ||
String getBackendName(); | ||
} |
15 changes: 15 additions & 0 deletions
15
src/pandroid/app/src/main/java/com/panda3ds/pandroid/view/renderer/layout/ConsoleLayout.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,15 @@ | ||
package com.panda3ds.pandroid.view.renderer.layout; | ||
|
||
import android.graphics.Rect; | ||
|
||
import com.panda3ds.pandroid.math.Vector2; | ||
|
||
public interface ConsoleLayout { | ||
void update(int screenWidth, int screenHeight); | ||
|
||
void setBottomDisplaySourceSize(int width, int height); | ||
void setTopDisplaySourceSize(int width, int height); | ||
|
||
Rect getBottomDisplayBounds(); | ||
Rect getTopDisplayBounds(); | ||
} |
Oops, something went wrong.