Revision b6468abb
Added by Leszek Koltunski about 5 years ago
| src/main/java/org/distorted/dialogs/RubikDialogInfo.java | ||
|---|---|---|
| 75 | 75 |
public void onClick(DialogInterface dialog, int which) |
| 76 | 76 |
{
|
| 77 | 77 |
RubikActivity ract = (RubikActivity)getContext(); |
| 78 |
Intent myIntent = new Intent(ract, TutorialActivity.class); |
|
| 79 |
//myIntent.putExtra("", value); //Optional parameters
|
|
| 80 |
|
|
| 81 |
if( ract!=null ) ract.startActivity(myIntent); |
|
| 78 |
if( ract!=null ) ract.switchTutorial(); |
|
| 82 | 79 |
} |
| 83 | 80 |
}); |
| 84 | 81 |
|
| src/main/java/org/distorted/main/RubikActivity.java | ||
|---|---|---|
| 19 | 19 |
|
| 20 | 20 |
package org.distorted.main; |
| 21 | 21 |
|
| 22 |
import android.content.Intent; |
|
| 22 | 23 |
import android.content.SharedPreferences; |
| 23 | 24 |
import android.os.Build; |
| 24 | 25 |
import android.os.Bundle; |
| ... | ... | |
| 46 | 47 |
import org.distorted.objects.ObjectList; |
| 47 | 48 |
import org.distorted.states.StateList; |
| 48 | 49 |
import org.distorted.states.RubikStatePlay; |
| 50 |
import org.distorted.tutorial.TutorialActivity; |
|
| 49 | 51 |
|
| 50 | 52 |
import java.util.Locale; |
| 51 | 53 |
|
| ... | ... | |
| 547 | 549 |
{
|
| 548 | 550 |
return mIsLocked; |
| 549 | 551 |
} |
| 552 |
|
|
| 553 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 554 |
|
|
| 555 |
public void switchTutorial() |
|
| 556 |
{
|
|
| 557 |
// DistortedLibrary.onPause(); |
|
| 558 |
// DistortedLibrary.onDestroy(); |
|
| 559 |
|
|
| 560 |
Intent myIntent = new Intent(this, TutorialActivity.class); |
|
| 561 |
//myIntent.putExtra("", value); //Optional parameters
|
|
| 562 |
startActivity(myIntent); |
|
| 563 |
} |
|
| 550 | 564 |
} |
| src/main/java/org/distorted/tutorial/TutorialActivity.java | ||
|---|---|---|
| 33 | 33 |
import com.google.firebase.analytics.FirebaseAnalytics; |
| 34 | 34 |
|
| 35 | 35 |
import org.distorted.dialogs.RubikDialogError; |
| 36 |
import org.distorted.library.main.DistortedLibrary; |
|
| 36 | 37 |
import org.distorted.main.R; |
| 37 | 38 |
import org.distorted.objects.ObjectList; |
| 38 | 39 |
import org.distorted.objects.TwistyObject; |
| ... | ... | |
| 115 | 116 |
{
|
| 116 | 117 |
super.onAttachedToWindow(); |
| 117 | 118 |
|
| 118 |
final float RATIO = 0.10f;
|
|
| 119 |
final float RATIO = 0.30f;
|
|
| 119 | 120 |
float width = getScreenWidthInPixels(); |
| 120 | 121 |
LinearLayout layout = findViewById(R.id.rightBar); |
| 121 | 122 |
ViewGroup.LayoutParams params = layout.getLayoutParams(); |
| ... | ... | |
| 155 | 156 |
super.onPause(); |
| 156 | 157 |
TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView); |
| 157 | 158 |
view.onPause(); |
| 159 |
DistortedLibrary.onPause(); |
|
| 158 | 160 |
} |
| 159 | 161 |
|
| 160 | 162 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| src/main/java/org/distorted/tutorial/TutorialRenderer.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.opengl.GLSurfaceView; |
| 23 | 23 |
|
| 24 |
import org.distorted.effects.BaseEffect; |
|
| 25 |
import org.distorted.library.effect.EffectType; |
|
| 26 |
import org.distorted.library.effect.VertexEffectQuaternion; |
|
| 27 |
import org.distorted.library.effect.VertexEffectRotate; |
|
| 28 |
import org.distorted.library.main.DistortedLibrary; |
|
| 24 | 29 |
import org.distorted.library.main.DistortedScreen; |
| 25 | 30 |
|
| 26 | 31 |
import javax.microedition.khronos.egl.EGLConfig; |
| ... | ... | |
| 28 | 33 |
|
| 29 | 34 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 30 | 35 |
|
| 31 |
public class TutorialRenderer implements GLSurfaceView.Renderer |
|
| 36 |
public class TutorialRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
| 32 | 37 |
{
|
| 33 | 38 |
private TutorialSurfaceView mView; |
| 34 | 39 |
private DistortedScreen mScreen; |
| ... | ... | |
| 69 | 74 |
@Override |
| 70 | 75 |
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) |
| 71 | 76 |
{
|
| 77 |
DistortedLibrary.setMax(EffectType.VERTEX,25); // 24 Cube Quats + Rotate |
|
| 78 |
VertexEffectRotate.enable(); |
|
| 79 |
VertexEffectQuaternion.enable(); |
|
| 80 |
BaseEffect.Type.enableEffects(); |
|
| 72 | 81 |
|
| 82 |
DistortedLibrary.onCreate(mView.getContext(),this,1); |
|
| 73 | 83 |
} |
| 74 | 84 |
|
| 85 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 86 |
|
|
| 87 |
public void distortedException(Exception ex) |
|
| 88 |
{
|
|
| 89 |
android.util.Log.e("TUTORIAL", "unexpected exception: "+ex.getMessage() );
|
|
| 90 |
} |
|
| 91 |
|
|
| 75 | 92 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 76 | 93 |
|
| 77 | 94 |
DistortedScreen getScreen() |
Also available in: Unified diff
Progress with using the Library in a second Activity.