Revision ed0ea1c5
Added by Leszek Koltunski over 2 years ago
| build.gradle | ||
|---|---|---|
| 55 | 55 |
implementation "com.android.billingclient:billing:5.1.0" |
| 56 | 56 |
implementation project(path: ':distorted-puzzle-jsons') |
| 57 | 57 |
implementation project(path: ':distorted-puzzle-dmesh') |
| 58 |
implementation project(path: ':distorted-os-android') |
|
| 58 | 59 |
} |
| src/main/java/org/distorted/bandaged/BandagedOSInterface.java | ||
|---|---|---|
| 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 2 |
// Copyright 2023 Leszek Koltunski // |
|
| 3 |
// // |
|
| 4 |
// This file is part of Magic Cube. // |
|
| 5 |
// // |
|
| 6 |
// Magic Cube is proprietary software licensed under an EULA which you should have received // |
|
| 7 |
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html // |
|
| 8 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 9 |
|
|
| 10 |
package org.distorted.bandaged; |
|
| 11 |
|
|
| 12 |
import android.util.DisplayMetrics; |
|
| 13 |
|
|
| 14 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
| 15 |
|
|
| 16 |
import java.lang.ref.WeakReference; |
|
| 17 |
|
|
| 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 19 |
|
|
| 20 |
public class BandagedOSInterface implements OperatingSystemInterface |
|
| 21 |
{
|
|
| 22 |
private final WeakReference<BandagedPlayActivity> mAct; |
|
| 23 |
|
|
| 24 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 25 |
|
|
| 26 |
BandagedOSInterface(BandagedPlayActivity act) |
|
| 27 |
{
|
|
| 28 |
mAct = new WeakReference<>(act); |
|
| 29 |
} |
|
| 30 |
|
|
| 31 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 32 |
|
|
| 33 |
public int getScreenDensity() |
|
| 34 |
{
|
|
| 35 |
DisplayMetrics dm = new DisplayMetrics(); |
|
| 36 |
mAct.get().getWindowManager().getDefaultDisplay().getMetrics(dm); |
|
| 37 |
return dm.densityDpi; |
|
| 38 |
} |
|
| 39 |
} |
|
| src/main/java/org/distorted/bandaged/BandagedPlayView.java | ||
|---|---|---|
| 22 | 22 |
|
| 23 | 23 |
import org.distorted.objectlib.main.ObjectControl; |
| 24 | 24 |
import org.distorted.objectlib.main.TwistyObjectNode; |
| 25 |
import org.distorted.os.OSInterface; |
|
| 25 | 26 |
|
| 26 | 27 |
import static org.distorted.objectlib.main.ObjectControl.MODE_ROTATE; |
| 27 | 28 |
|
| ... | ... | |
| 30 | 31 |
public class BandagedPlayView extends GLSurfaceView |
| 31 | 32 |
{
|
| 32 | 33 |
private ObjectControl mObjectController; |
| 33 |
private BandagedOSInterface mInterface;
|
|
| 34 |
private OSInterface mInterface; |
|
| 34 | 35 |
private BandagedPlayRenderer mRenderer; |
| 35 | 36 |
private int mScreenWidth, mScreenHeight; |
| 36 | 37 |
private boolean mCreated; |
| ... | ... | |
| 81 | 82 |
{
|
| 82 | 83 |
BandagedPlayActivity act = (BandagedPlayActivity)context; |
| 83 | 84 |
BandagedPlayLibInterface ref = new BandagedPlayLibInterface(act); |
| 84 |
mInterface = new BandagedOSInterface(act);
|
|
| 85 |
mInterface = new OSInterface(act); |
|
| 85 | 86 |
mObjectController = new ObjectControl(ref,mInterface); |
| 86 | 87 |
mObjectController.setRotateOnCreation(true); |
| 87 | 88 |
mRenderer = new BandagedPlayRenderer(this); |
| src/main/java/org/distorted/config/ConfigOSInterface.java | ||
|---|---|---|
| 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 2 |
// Copyright 2023 Leszek Koltunski // |
|
| 3 |
// // |
|
| 4 |
// This file is part of Magic Cube. // |
|
| 5 |
// // |
|
| 6 |
// Magic Cube is proprietary software licensed under an EULA which you should have received // |
|
| 7 |
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html // |
|
| 8 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 9 |
|
|
| 10 |
package org.distorted.config; |
|
| 11 |
|
|
| 12 |
import android.util.DisplayMetrics; |
|
| 13 |
|
|
| 14 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
| 15 |
|
|
| 16 |
import java.lang.ref.WeakReference; |
|
| 17 |
|
|
| 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 19 |
|
|
| 20 |
public class ConfigOSInterface implements OperatingSystemInterface |
|
| 21 |
{
|
|
| 22 |
private final WeakReference<ConfigActivity> mAct; |
|
| 23 |
|
|
| 24 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 25 |
|
|
| 26 |
ConfigOSInterface(ConfigActivity act) |
|
| 27 |
{
|
|
| 28 |
mAct = new WeakReference<>(act); |
|
| 29 |
} |
|
| 30 |
|
|
| 31 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 32 |
|
|
| 33 |
public int getScreenDensity() |
|
| 34 |
{
|
|
| 35 |
DisplayMetrics dm = new DisplayMetrics(); |
|
| 36 |
mAct.get().getWindowManager().getDefaultDisplay().getMetrics(dm); |
|
| 37 |
return dm.densityDpi; |
|
| 38 |
} |
|
| 39 |
} |
|
| src/main/java/org/distorted/config/ConfigSurfaceView.java | ||
|---|---|---|
| 20 | 20 |
|
| 21 | 21 |
import org.distorted.objectlib.main.ObjectControl; |
| 22 | 22 |
import org.distorted.objectlib.main.TwistyObjectNode; |
| 23 |
import org.distorted.os.OSInterface; |
|
| 23 | 24 |
|
| 24 | 25 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 25 | 26 |
|
| 26 | 27 |
public class ConfigSurfaceView extends GLSurfaceView |
| 27 | 28 |
{
|
| 28 | 29 |
private ObjectControl mObjectController; |
| 29 |
private ConfigOSInterface mInterface;
|
|
| 30 |
private OSInterface mInterface; |
|
| 30 | 31 |
private ConfigRenderer mRenderer; |
| 31 | 32 |
private int mScreenWidth, mScreenHeight; |
| 32 | 33 |
private boolean mCreated; |
| ... | ... | |
| 77 | 78 |
{
|
| 78 | 79 |
ConfigActivity act = (ConfigActivity)context; |
| 79 | 80 |
ConfigObjectLibInterface ref = new ConfigObjectLibInterface(); |
| 80 |
mInterface = new ConfigOSInterface(act);
|
|
| 81 |
mInterface = new OSInterface(act); |
|
| 81 | 82 |
mObjectController = new ObjectControl(ref,mInterface); |
| 82 | 83 |
mObjectController.setRotateOnCreation(true); |
| 83 | 84 |
mRenderer = new ConfigRenderer(this); |
| src/main/java/org/distorted/main/RubikOSInterface.java | ||
|---|---|---|
| 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 2 |
// Copyright 2023 Leszek Koltunski // |
|
| 3 |
// // |
|
| 4 |
// This file is part of Magic Cube. // |
|
| 5 |
// // |
|
| 6 |
// Magic Cube is proprietary software licensed under an EULA which you should have received // |
|
| 7 |
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html // |
|
| 8 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 9 |
|
|
| 10 |
package org.distorted.main; |
|
| 11 |
|
|
| 12 |
import android.util.DisplayMetrics; |
|
| 13 |
|
|
| 14 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
| 15 |
|
|
| 16 |
import java.lang.ref.WeakReference; |
|
| 17 |
|
|
| 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 19 |
|
|
| 20 |
public class RubikOSInterface implements OperatingSystemInterface |
|
| 21 |
{
|
|
| 22 |
private final WeakReference<RubikActivity> mAct; |
|
| 23 |
|
|
| 24 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 25 |
|
|
| 26 |
RubikOSInterface(RubikActivity act) |
|
| 27 |
{
|
|
| 28 |
mAct = new WeakReference<>(act); |
|
| 29 |
} |
|
| 30 |
|
|
| 31 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 32 |
|
|
| 33 |
public int getScreenDensity() |
|
| 34 |
{
|
|
| 35 |
DisplayMetrics dm = new DisplayMetrics(); |
|
| 36 |
mAct.get().getWindowManager().getDefaultDisplay().getMetrics(dm); |
|
| 37 |
return dm.densityDpi; |
|
| 38 |
} |
|
| 39 |
} |
|
| src/main/java/org/distorted/main/RubikSurfaceView.java | ||
|---|---|---|
| 24 | 24 |
import org.distorted.library.main.DistortedScreen; |
| 25 | 25 |
import org.distorted.objectlib.main.ObjectControl; |
| 26 | 26 |
import org.distorted.objectlib.main.TwistyObjectNode; |
| 27 |
import org.distorted.os.OSInterface; |
|
| 27 | 28 |
import org.distorted.overlays.DataStars; |
| 28 | 29 |
import org.distorted.overlays.OverlayStars; |
| 29 | 30 |
import org.distorted.screens.ScreenList; |
| ... | ... | |
| 33 | 34 |
public class RubikSurfaceView extends GLSurfaceView |
| 34 | 35 |
{
|
| 35 | 36 |
private ObjectControl mObjectController; |
| 36 |
private RubikOSInterface mInterface;
|
|
| 37 |
private OSInterface mInterface; |
|
| 37 | 38 |
private RubikRenderer mRenderer; |
| 38 | 39 |
private int mScreenWidth, mScreenHeight; |
| 39 | 40 |
private boolean mCreated; |
| ... | ... | |
| 112 | 113 |
{
|
| 113 | 114 |
RubikActivity act = (RubikActivity)context; |
| 114 | 115 |
RubikObjectLibInterface ref = new RubikObjectLibInterface(act); |
| 115 |
mInterface = new RubikOSInterface(act);
|
|
| 116 |
mInterface = new OSInterface(act); |
|
| 116 | 117 |
mObjectController = new ObjectControl(ref,mInterface); |
| 117 | 118 |
mRenderer = new RubikRenderer(this); |
| 118 | 119 |
|
| src/main/java/org/distorted/purchase/PurchaseOSInterface.java | ||
|---|---|---|
| 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 2 |
// Copyright 2023 Leszek Koltunski // |
|
| 3 |
// // |
|
| 4 |
// This file is part of Magic Cube. // |
|
| 5 |
// // |
|
| 6 |
// Magic Cube is proprietary software licensed under an EULA which you should have received // |
|
| 7 |
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html // |
|
| 8 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 9 |
|
|
| 10 |
package org.distorted.purchase; |
|
| 11 |
|
|
| 12 |
import android.util.DisplayMetrics; |
|
| 13 |
|
|
| 14 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
| 15 |
|
|
| 16 |
import java.lang.ref.WeakReference; |
|
| 17 |
|
|
| 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 19 |
|
|
| 20 |
public class PurchaseOSInterface implements OperatingSystemInterface |
|
| 21 |
{
|
|
| 22 |
private final WeakReference<PurchaseActivity> mAct; |
|
| 23 |
|
|
| 24 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 25 |
|
|
| 26 |
PurchaseOSInterface(PurchaseActivity act) |
|
| 27 |
{
|
|
| 28 |
mAct = new WeakReference<>(act); |
|
| 29 |
} |
|
| 30 |
|
|
| 31 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 32 |
|
|
| 33 |
public int getScreenDensity() |
|
| 34 |
{
|
|
| 35 |
DisplayMetrics dm = new DisplayMetrics(); |
|
| 36 |
mAct.get().getWindowManager().getDefaultDisplay().getMetrics(dm); |
|
| 37 |
return dm.densityDpi; |
|
| 38 |
} |
|
| 39 |
} |
|
| src/main/java/org/distorted/purchase/PurchaseSurfaceView.java | ||
|---|---|---|
| 20 | 20 |
|
| 21 | 21 |
import org.distorted.objectlib.main.ObjectControl; |
| 22 | 22 |
import org.distorted.objectlib.main.TwistyObjectNode; |
| 23 |
import org.distorted.os.OSInterface; |
|
| 23 | 24 |
|
| 24 | 25 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 25 | 26 |
|
| 26 | 27 |
public class PurchaseSurfaceView extends GLSurfaceView |
| 27 | 28 |
{
|
| 28 | 29 |
private ObjectControl mObjectController; |
| 29 |
private PurchaseOSInterface mInterface;
|
|
| 30 |
private OSInterface mInterface; |
|
| 30 | 31 |
private PurchaseRenderer mRenderer; |
| 31 | 32 |
private boolean mCreated; |
| 32 | 33 |
|
| ... | ... | |
| 74 | 75 |
{
|
| 75 | 76 |
PurchaseActivity act = (PurchaseActivity)context; |
| 76 | 77 |
PurchaseObjectLibInterface ref = new PurchaseObjectLibInterface(); |
| 77 |
mInterface = new PurchaseOSInterface(act);
|
|
| 78 |
mInterface = new OSInterface(act); |
|
| 78 | 79 |
mObjectController = new ObjectControl(ref,mInterface); |
| 79 | 80 |
mObjectController.setRotateOnCreation(true); |
| 80 | 81 |
mRenderer = new PurchaseRenderer(this); |
| src/main/java/org/distorted/tutorials/TutorialOSInterface.java | ||
|---|---|---|
| 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 2 |
// Copyright 2023 Leszek Koltunski // |
|
| 3 |
// // |
|
| 4 |
// This file is part of Magic Cube. // |
|
| 5 |
// // |
|
| 6 |
// Magic Cube is proprietary software licensed under an EULA which you should have received // |
|
| 7 |
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html // |
|
| 8 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 9 |
|
|
| 10 |
package org.distorted.tutorials; |
|
| 11 |
|
|
| 12 |
import android.util.DisplayMetrics; |
|
| 13 |
|
|
| 14 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
| 15 |
|
|
| 16 |
import java.lang.ref.WeakReference; |
|
| 17 |
|
|
| 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 19 |
|
|
| 20 |
public class TutorialOSInterface implements OperatingSystemInterface |
|
| 21 |
{
|
|
| 22 |
private final WeakReference<TutorialActivity> mAct; |
|
| 23 |
|
|
| 24 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 25 |
|
|
| 26 |
TutorialOSInterface(TutorialActivity act) |
|
| 27 |
{
|
|
| 28 |
mAct = new WeakReference<>(act); |
|
| 29 |
} |
|
| 30 |
|
|
| 31 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 32 |
|
|
| 33 |
public int getScreenDensity() |
|
| 34 |
{
|
|
| 35 |
DisplayMetrics dm = new DisplayMetrics(); |
|
| 36 |
mAct.get().getWindowManager().getDefaultDisplay().getMetrics(dm); |
|
| 37 |
return dm.densityDpi; |
|
| 38 |
} |
|
| 39 |
} |
|
| src/main/java/org/distorted/tutorials/TutorialSurfaceView.java | ||
|---|---|---|
| 20 | 20 |
|
| 21 | 21 |
import org.distorted.objectlib.main.ObjectControl; |
| 22 | 22 |
import org.distorted.objectlib.main.TwistyObjectNode; |
| 23 |
import org.distorted.os.OSInterface; |
|
| 23 | 24 |
|
| 24 | 25 |
import static org.distorted.objectlib.main.ObjectControl.MODE_ROTATE; |
| 25 | 26 |
import static org.distorted.objectlib.main.ObjectControl.MODE_DRAG; |
| ... | ... | |
| 29 | 30 |
public class TutorialSurfaceView extends GLSurfaceView |
| 30 | 31 |
{
|
| 31 | 32 |
private ObjectControl mObjectController; |
| 32 |
private TutorialOSInterface mInterface;
|
|
| 33 |
private OSInterface mInterface; |
|
| 33 | 34 |
private TutorialRenderer mRenderer; |
| 34 | 35 |
private int mScreenWidth, mScreenHeight; |
| 35 | 36 |
private boolean mCreated; |
| ... | ... | |
| 86 | 87 |
{
|
| 87 | 88 |
TutorialActivity act = (TutorialActivity)context; |
| 88 | 89 |
TutorialObjectLibInterface ref = new TutorialObjectLibInterface(act); |
| 89 |
mInterface = new TutorialOSInterface(act);
|
|
| 90 |
mInterface = new OSInterface(act); |
|
| 90 | 91 |
mObjectController = new ObjectControl(ref,mInterface); |
| 91 | 92 |
mRenderer = new TutorialRenderer(this); |
| 92 | 93 |
|
Also available in: Unified diff
Move the OSInterface to a separate module