mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-02-23 15:38:29 +01:00
Attempt to fix perf issue with filters
that plagues some devices only.
This commit is contained in:
@@ -193,18 +193,46 @@
|
||||
{
|
||||
"nextPhraseID":"npc3_1",
|
||||
"text":"Beer!"
|
||||
},
|
||||
{
|
||||
"nextPhraseID":"npc3_2",
|
||||
"text":"Lights out!"
|
||||
},
|
||||
{
|
||||
"nextPhraseID":"npc3_3",
|
||||
"text":"Lights on!"
|
||||
"text":"No filter!"
|
||||
},
|
||||
{
|
||||
"nextPhraseID":"npc3_5",
|
||||
"text":"Black 20%!"
|
||||
},
|
||||
{
|
||||
"nextPhraseID":"npc3_6",
|
||||
"text":"Black 40%!"
|
||||
},
|
||||
{
|
||||
"nextPhraseID":"npc3_7",
|
||||
"text":"Black 60%!"
|
||||
},
|
||||
{
|
||||
"nextPhraseID":"npc3_2",
|
||||
"text":"Black 80%!"
|
||||
},
|
||||
{
|
||||
"nextPhraseID":"npc3_4",
|
||||
"text":"Red ligths!"
|
||||
},
|
||||
{
|
||||
"nextPhraseID":"npc3_9",
|
||||
"text":"Green ligths!"
|
||||
},
|
||||
{
|
||||
"nextPhraseID":"npc3_10",
|
||||
"text":"Blue ligths!"
|
||||
},
|
||||
{
|
||||
"nextPhraseID":"npc3_11",
|
||||
"text":"Black & White!"
|
||||
},
|
||||
{
|
||||
"nextPhraseID":"npc3_8",
|
||||
"text":"Invert!"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -266,6 +294,83 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"npc3_5",
|
||||
"message":"Ok.",
|
||||
"rewards":[
|
||||
{
|
||||
"rewardType":"changeMapFilter",
|
||||
"rewardID":"black20",
|
||||
"mapName":"debugmap"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"npc3_6",
|
||||
"message":"Ok.",
|
||||
"rewards":[
|
||||
{
|
||||
"rewardType":"changeMapFilter",
|
||||
"rewardID":"black40",
|
||||
"mapName":"debugmap"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"npc3_7",
|
||||
"message":"Ok.",
|
||||
"rewards":[
|
||||
{
|
||||
"rewardType":"changeMapFilter",
|
||||
"rewardID":"black60",
|
||||
"mapName":"debugmap"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"npc3_8",
|
||||
"message":"Ok.",
|
||||
"rewards":[
|
||||
{
|
||||
"rewardType":"changeMapFilter",
|
||||
"rewardID":"invert",
|
||||
"mapName":"debugmap"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"npc3_9",
|
||||
"message":"Ok.",
|
||||
"rewards":[
|
||||
{
|
||||
"rewardType":"changeMapFilter",
|
||||
"rewardID":"greentint",
|
||||
"mapName":"debugmap"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"npc3_10",
|
||||
"message":"Ok.",
|
||||
"rewards":[
|
||||
{
|
||||
"rewardType":"changeMapFilter",
|
||||
"rewardID":"bluetint",
|
||||
"mapName":"debugmap"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"npc3_11",
|
||||
"message":"Ok.",
|
||||
"rewards":[
|
||||
{
|
||||
"rewardType":"changeMapFilter",
|
||||
"rewardID":"bw",
|
||||
"mapName":"debugmap"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"chaotic_rewarder_0",
|
||||
"message":"What do you want ?",
|
||||
|
||||
@@ -475,6 +475,10 @@
|
||||
<string name="preferences_optimized_drawing_title">Optimized drawing</string>
|
||||
<string name="preferences_optimized_drawing">Disable this if you see graphical artifacts. Enabling this option will make the game only redraw changed parts of the screen every frame.</string>
|
||||
|
||||
<string name="preferences_high_quality_filters_title">High quality filters</string>
|
||||
<string name="preferences_high_quality_filters">Disable this if you experience performance issues on filtered maps (dark caves for example). Enabling this option will make the game use advanced color filters, instead of solid color overlays.</string>
|
||||
|
||||
|
||||
<!-- =========================================== -->
|
||||
<!-- Added in v0.6.11 -->
|
||||
|
||||
|
||||
@@ -26,6 +26,11 @@
|
||||
android:defaultValue="false"
|
||||
android:summary="@string/preferences_optimized_drawing"
|
||||
android:key="optimized_drawing" />
|
||||
<CheckBoxPreference
|
||||
android:title="@string/preferences_high_quality_filters_title"
|
||||
android:defaultValue="true"
|
||||
android:summary="@string/preferences_high_quality_filters"
|
||||
android:key="high_quality_filters" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:title="@string/preferences_dialog_category">
|
||||
|
||||
@@ -3,28 +3,27 @@ package com.gpl.rpg.AndorsTrail;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.context.ControllerContext;
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.controller.Constants;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.context.ControllerContext;
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.controller.Constants;
|
||||
import com.gpl.rpg.AndorsTrail.util.L;
|
||||
|
||||
public final class AndorsTrailApplication extends Application {
|
||||
|
||||
public static final boolean DEVELOPMENT_DEBUGRESOURCES = false;
|
||||
public static final boolean DEVELOPMENT_DEBUGRESOURCES = true;
|
||||
public static final boolean DEVELOPMENT_FORCE_STARTNEWGAME = false;
|
||||
public static final boolean DEVELOPMENT_FORCE_CONTINUEGAME = false;
|
||||
public static final boolean DEVELOPMENT_DEBUGBUTTONS = false;
|
||||
public static final boolean DEVELOPMENT_DEBUGBUTTONS = true;
|
||||
public static final boolean DEVELOPMENT_FASTSPEED = false;
|
||||
public static final boolean DEVELOPMENT_VALIDATEDATA = true;
|
||||
public static final boolean DEVELOPMENT_DEBUGMESSAGES = true;
|
||||
|
||||
@@ -1,102 +1,105 @@
|
||||
package com.gpl.rpg.AndorsTrail;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
public final class AndorsTrailPreferences {
|
||||
public static final int DISPLAYLOOT_DIALOG_ALWAYS = 0;
|
||||
public static final int DISPLAYLOOT_DIALOG_FOR_ITEMS = 3;
|
||||
public static final int DISPLAYLOOT_DIALOG_FOR_ITEMS_ELSE_TOAST = 4;
|
||||
public static final int DISPLAYLOOT_TOAST = 1;
|
||||
public static final int DISPLAYLOOT_TOAST_FOR_ITEMS = 5;
|
||||
public static final int DISPLAYLOOT_NONE = 2;
|
||||
public static final int MOVEMENTMETHOD_STRAIGHT = 0;
|
||||
public static final int MOVEMENTMETHOD_DIRECTIONAL = 1;
|
||||
public static final int MOVEMENTAGGRESSIVENESS_NORMAL = 0;
|
||||
public static final int MOVEMENTAGGRESSIVENESS_AGGRESSIVE = 1;
|
||||
public static final int MOVEMENTAGGRESSIVENESS_DEFENSIVE = 2;
|
||||
public static final int DPAD_POSITION_DISABLED = 0;
|
||||
public static final int DPAD_POSITION_LOWER_RIGHT = 1;
|
||||
public static final int DPAD_POSITION_LOWER_LEFT = 2;
|
||||
public static final int DPAD_POSITION_LOWER_CENTER = 3;
|
||||
public static final int DPAD_POSITION_CENTER_LEFT = 4;
|
||||
public static final int DPAD_POSITION_CENTER_RIGHT = 5;
|
||||
public static final int DPAD_POSITION_UPPER_LEFT = 6;
|
||||
public static final int DPAD_POSITION_UPPER_RIGHT = 7;
|
||||
public static final int DPAD_POSITION_UPPER_CENTER = 8;
|
||||
public static final int CONFIRM_OVERWRITE_SAVEGAME_ALWAYS = 0;
|
||||
public static final int CONFIRM_OVERWRITE_SAVEGAME_WHEN_PLAYERNAME_DIFFERS = 1;
|
||||
public static final int CONFIRM_OVERWRITE_SAVEGAME_NEVER = 2;
|
||||
public static final int QUICKSLOTS_POSITION_HORIZONTAL_CENTER_BOTTOM = 0;
|
||||
public static final int QUICKSLOTS_POSITION_VERTICAL_CENTER_LEFT = 1;
|
||||
public static final int QUICKSLOTS_POSITION_VERTICAL_CENTER_RIGHT = 2;
|
||||
public static final int QUICKSLOTS_POSITION_VERTICAL_BOTTOM_LEFT = 3;
|
||||
public static final int QUICKSLOTS_POSITION_HORIZONTAL_BOTTOM_LEFT = 4;
|
||||
public static final int QUICKSLOTS_POSITION_HORIZONTAL_BOTTOM_RIGHT = 5;
|
||||
public static final int QUICKSLOTS_POSITION_VERTICAL_BOTTOM_RIGHT = 6;
|
||||
public static final int ATTACKSPEED_DEFAULT_MILLISECONDS = 1000;
|
||||
|
||||
public boolean confirmRest = true;
|
||||
public boolean confirmAttack = true;
|
||||
public int displayLoot = DISPLAYLOOT_DIALOG_ALWAYS;
|
||||
public boolean fullscreen = true;
|
||||
public int attackspeed_milliseconds = 1000;
|
||||
public int movementMethod = MOVEMENTMETHOD_STRAIGHT;
|
||||
public int movementAggressiveness = MOVEMENTAGGRESSIVENESS_NORMAL;
|
||||
public float scalingFactor = 1.0f;
|
||||
public int dpadPosition;
|
||||
public boolean dpadMinimizeable = true;
|
||||
public boolean optimizedDrawing = false;
|
||||
public boolean enableUiAnimations = true;
|
||||
public int displayOverwriteSavegame = CONFIRM_OVERWRITE_SAVEGAME_ALWAYS;
|
||||
public int quickslotsPosition = QUICKSLOTS_POSITION_HORIZONTAL_CENTER_BOTTOM;
|
||||
public boolean showQuickslotsWhenToolboxIsVisible = false;
|
||||
public boolean useLocalizedResources = true;
|
||||
public int selectedTheme = 0;
|
||||
|
||||
public void read(final Context androidContext) {
|
||||
AndorsTrailPreferences dest = this;
|
||||
try {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(androidContext);
|
||||
dest.confirmRest = prefs.getBoolean("confirm_rest", true);
|
||||
dest.confirmAttack = prefs.getBoolean("confirm_attack", true);
|
||||
dest.displayLoot = Integer.parseInt(prefs.getString("display_lootdialog", Integer.toString(DISPLAYLOOT_DIALOG_ALWAYS)));
|
||||
dest.fullscreen = prefs.getBoolean("fullscreen", true);
|
||||
dest.attackspeed_milliseconds = Integer.parseInt(prefs.getString("attackspeed", "1000"));
|
||||
dest.movementMethod = Integer.parseInt(prefs.getString("movementmethod", Integer.toString(MOVEMENTMETHOD_STRAIGHT)));
|
||||
dest.scalingFactor = Float.parseFloat(prefs.getString("scaling_factor", "1.0f"));
|
||||
dest.dpadPosition = Integer.parseInt(prefs.getString("dpadposition", Integer.toString(DPAD_POSITION_DISABLED)));
|
||||
dest.dpadMinimizeable = prefs.getBoolean("dpadMinimizeable", true);
|
||||
dest.optimizedDrawing = prefs.getBoolean("optimized_drawing", false);
|
||||
dest.enableUiAnimations = prefs.getBoolean("enableUiAnimations", true);
|
||||
dest.displayOverwriteSavegame = Integer.parseInt(prefs.getString("display_overwrite_savegame", Integer.toString(CONFIRM_OVERWRITE_SAVEGAME_ALWAYS)));
|
||||
dest.quickslotsPosition = Integer.parseInt(prefs.getString("quickslots_placement", Integer.toString(QUICKSLOTS_POSITION_HORIZONTAL_CENTER_BOTTOM)));
|
||||
dest.showQuickslotsWhenToolboxIsVisible = prefs.getBoolean("showQuickslotsWhenToolboxIsVisible", false);
|
||||
dest.useLocalizedResources = prefs.getBoolean("useLocalizedResources", true);
|
||||
dest.selectedTheme = Integer.parseInt(prefs.getString("selectedTheme", Integer.toString(0)));
|
||||
// This might be implemented as a skill in the future.
|
||||
//dest.movementAggressiveness = Integer.parseInt(prefs.getString("movementaggressiveness", Integer.toString(MOVEMENTAGGRESSIVENESS_NORMAL)));
|
||||
} catch (Exception e) {
|
||||
dest.confirmRest = true;
|
||||
dest.confirmAttack = true;
|
||||
dest.displayLoot = DISPLAYLOOT_DIALOG_ALWAYS;
|
||||
dest.fullscreen = true;
|
||||
dest.attackspeed_milliseconds = 1000;
|
||||
dest.movementMethod = MOVEMENTMETHOD_STRAIGHT;
|
||||
dest.movementAggressiveness = MOVEMENTAGGRESSIVENESS_NORMAL;
|
||||
dest.scalingFactor = 1.0f;
|
||||
dest.dpadPosition = DPAD_POSITION_DISABLED;
|
||||
dest.dpadMinimizeable = true;
|
||||
dest.optimizedDrawing = false;
|
||||
dest.enableUiAnimations = true;
|
||||
dest.displayOverwriteSavegame = CONFIRM_OVERWRITE_SAVEGAME_ALWAYS;
|
||||
dest.quickslotsPosition = QUICKSLOTS_POSITION_HORIZONTAL_CENTER_BOTTOM;
|
||||
dest.showQuickslotsWhenToolboxIsVisible = false;
|
||||
dest.useLocalizedResources = true;
|
||||
dest.selectedTheme = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
package com.gpl.rpg.AndorsTrail;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
public final class AndorsTrailPreferences {
|
||||
public static final int DISPLAYLOOT_DIALOG_ALWAYS = 0;
|
||||
public static final int DISPLAYLOOT_DIALOG_FOR_ITEMS = 3;
|
||||
public static final int DISPLAYLOOT_DIALOG_FOR_ITEMS_ELSE_TOAST = 4;
|
||||
public static final int DISPLAYLOOT_TOAST = 1;
|
||||
public static final int DISPLAYLOOT_TOAST_FOR_ITEMS = 5;
|
||||
public static final int DISPLAYLOOT_NONE = 2;
|
||||
public static final int MOVEMENTMETHOD_STRAIGHT = 0;
|
||||
public static final int MOVEMENTMETHOD_DIRECTIONAL = 1;
|
||||
public static final int MOVEMENTAGGRESSIVENESS_NORMAL = 0;
|
||||
public static final int MOVEMENTAGGRESSIVENESS_AGGRESSIVE = 1;
|
||||
public static final int MOVEMENTAGGRESSIVENESS_DEFENSIVE = 2;
|
||||
public static final int DPAD_POSITION_DISABLED = 0;
|
||||
public static final int DPAD_POSITION_LOWER_RIGHT = 1;
|
||||
public static final int DPAD_POSITION_LOWER_LEFT = 2;
|
||||
public static final int DPAD_POSITION_LOWER_CENTER = 3;
|
||||
public static final int DPAD_POSITION_CENTER_LEFT = 4;
|
||||
public static final int DPAD_POSITION_CENTER_RIGHT = 5;
|
||||
public static final int DPAD_POSITION_UPPER_LEFT = 6;
|
||||
public static final int DPAD_POSITION_UPPER_RIGHT = 7;
|
||||
public static final int DPAD_POSITION_UPPER_CENTER = 8;
|
||||
public static final int CONFIRM_OVERWRITE_SAVEGAME_ALWAYS = 0;
|
||||
public static final int CONFIRM_OVERWRITE_SAVEGAME_WHEN_PLAYERNAME_DIFFERS = 1;
|
||||
public static final int CONFIRM_OVERWRITE_SAVEGAME_NEVER = 2;
|
||||
public static final int QUICKSLOTS_POSITION_HORIZONTAL_CENTER_BOTTOM = 0;
|
||||
public static final int QUICKSLOTS_POSITION_VERTICAL_CENTER_LEFT = 1;
|
||||
public static final int QUICKSLOTS_POSITION_VERTICAL_CENTER_RIGHT = 2;
|
||||
public static final int QUICKSLOTS_POSITION_VERTICAL_BOTTOM_LEFT = 3;
|
||||
public static final int QUICKSLOTS_POSITION_HORIZONTAL_BOTTOM_LEFT = 4;
|
||||
public static final int QUICKSLOTS_POSITION_HORIZONTAL_BOTTOM_RIGHT = 5;
|
||||
public static final int QUICKSLOTS_POSITION_VERTICAL_BOTTOM_RIGHT = 6;
|
||||
public static final int ATTACKSPEED_DEFAULT_MILLISECONDS = 1000;
|
||||
|
||||
public boolean confirmRest = true;
|
||||
public boolean confirmAttack = true;
|
||||
public int displayLoot = DISPLAYLOOT_DIALOG_ALWAYS;
|
||||
public boolean fullscreen = true;
|
||||
public int attackspeed_milliseconds = 1000;
|
||||
public int movementMethod = MOVEMENTMETHOD_STRAIGHT;
|
||||
public int movementAggressiveness = MOVEMENTAGGRESSIVENESS_NORMAL;
|
||||
public float scalingFactor = 1.0f;
|
||||
public int dpadPosition;
|
||||
public boolean dpadMinimizeable = true;
|
||||
public boolean optimizedDrawing = false;
|
||||
public boolean highQualityFilters = true;
|
||||
public boolean enableUiAnimations = true;
|
||||
public int displayOverwriteSavegame = CONFIRM_OVERWRITE_SAVEGAME_ALWAYS;
|
||||
public int quickslotsPosition = QUICKSLOTS_POSITION_HORIZONTAL_CENTER_BOTTOM;
|
||||
public boolean showQuickslotsWhenToolboxIsVisible = false;
|
||||
public boolean useLocalizedResources = true;
|
||||
public int selectedTheme = 0;
|
||||
|
||||
public void read(final Context androidContext) {
|
||||
AndorsTrailPreferences dest = this;
|
||||
try {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(androidContext);
|
||||
dest.confirmRest = prefs.getBoolean("confirm_rest", true);
|
||||
dest.confirmAttack = prefs.getBoolean("confirm_attack", true);
|
||||
dest.displayLoot = Integer.parseInt(prefs.getString("display_lootdialog", Integer.toString(DISPLAYLOOT_DIALOG_ALWAYS)));
|
||||
dest.fullscreen = prefs.getBoolean("fullscreen", true);
|
||||
dest.attackspeed_milliseconds = Integer.parseInt(prefs.getString("attackspeed", "1000"));
|
||||
dest.movementMethod = Integer.parseInt(prefs.getString("movementmethod", Integer.toString(MOVEMENTMETHOD_STRAIGHT)));
|
||||
dest.scalingFactor = Float.parseFloat(prefs.getString("scaling_factor", "1.0f"));
|
||||
dest.dpadPosition = Integer.parseInt(prefs.getString("dpadposition", Integer.toString(DPAD_POSITION_DISABLED)));
|
||||
dest.dpadMinimizeable = prefs.getBoolean("dpadMinimizeable", true);
|
||||
dest.optimizedDrawing = prefs.getBoolean("optimized_drawing", false);
|
||||
dest.highQualityFilters = prefs.getBoolean("high_quality_filters", true);
|
||||
dest.enableUiAnimations = prefs.getBoolean("enableUiAnimations", true);
|
||||
dest.displayOverwriteSavegame = Integer.parseInt(prefs.getString("display_overwrite_savegame", Integer.toString(CONFIRM_OVERWRITE_SAVEGAME_ALWAYS)));
|
||||
dest.quickslotsPosition = Integer.parseInt(prefs.getString("quickslots_placement", Integer.toString(QUICKSLOTS_POSITION_HORIZONTAL_CENTER_BOTTOM)));
|
||||
dest.showQuickslotsWhenToolboxIsVisible = prefs.getBoolean("showQuickslotsWhenToolboxIsVisible", false);
|
||||
dest.useLocalizedResources = prefs.getBoolean("useLocalizedResources", true);
|
||||
dest.selectedTheme = Integer.parseInt(prefs.getString("selectedTheme", Integer.toString(0)));
|
||||
// This might be implemented as a skill in the future.
|
||||
//dest.movementAggressiveness = Integer.parseInt(prefs.getString("movementaggressiveness", Integer.toString(MOVEMENTAGGRESSIVENESS_NORMAL)));
|
||||
} catch (Exception e) {
|
||||
dest.confirmRest = true;
|
||||
dest.confirmAttack = true;
|
||||
dest.displayLoot = DISPLAYLOOT_DIALOG_ALWAYS;
|
||||
dest.fullscreen = true;
|
||||
dest.attackspeed_milliseconds = 1000;
|
||||
dest.movementMethod = MOVEMENTMETHOD_STRAIGHT;
|
||||
dest.movementAggressiveness = MOVEMENTAGGRESSIVENESS_NORMAL;
|
||||
dest.scalingFactor = 1.0f;
|
||||
dest.dpadPosition = DPAD_POSITION_DISABLED;
|
||||
dest.dpadMinimizeable = true;
|
||||
dest.optimizedDrawing = false;
|
||||
dest.highQualityFilters = true;
|
||||
dest.enableUiAnimations = true;
|
||||
dest.displayOverwriteSavegame = CONFIRM_OVERWRITE_SAVEGAME_ALWAYS;
|
||||
dest.quickslotsPosition = QUICKSLOTS_POSITION_HORIZONTAL_CENTER_BOTTOM;
|
||||
dest.showQuickslotsWhenToolboxIsVisible = false;
|
||||
dest.useLocalizedResources = true;
|
||||
dest.selectedTheme = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public final class WorldMapController {
|
||||
this.cachedTiles = cachedTiles;
|
||||
this.tileSize = world.tileManager.tileSize;
|
||||
this.scale = (float) WORLDMAP_SCREENSHOT_TILESIZE / world.tileManager.tileSize;
|
||||
mapTiles.setColorFilter(mPaint);
|
||||
mapTiles.setColorFilter(mPaint, null, true);
|
||||
}
|
||||
|
||||
public Bitmap drawMap() {
|
||||
|
||||
@@ -2,14 +2,14 @@ package com.gpl.rpg.AndorsTrail.model.map;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.ColorMatrixColorFilter;
|
||||
import android.graphics.Paint;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.util.Coord;
|
||||
import com.gpl.rpg.AndorsTrail.util.CoordRect;
|
||||
import com.gpl.rpg.AndorsTrail.util.Size;
|
||||
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.ColorMatrixColorFilter;
|
||||
import android.graphics.Paint;
|
||||
|
||||
public final class LayeredTileMap {
|
||||
private static final ColorFilter colorFilterBlack20 = createGrayScaleColorFilter(0.8f);
|
||||
private static final ColorFilter colorFilterBlack40 = createGrayScaleColorFilter(0.6f);
|
||||
@@ -20,7 +20,6 @@ public final class LayeredTileMap {
|
||||
private static final ColorFilter colorFilterRedTint = createRedTintColorFilter();
|
||||
private static final ColorFilter colorFilterGreenTint = createGreenTintColorFilter();
|
||||
private static final ColorFilter colorFilterBlueTint = createBlueTintColorFilter();
|
||||
|
||||
|
||||
public enum ColorFilterId {
|
||||
none,
|
||||
@@ -89,8 +88,9 @@ public final class LayeredTileMap {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setColorFilter(Paint mPaint) {
|
||||
mPaint.setColorFilter(getColorFilter());
|
||||
public void setColorFilter(Paint mPaint, Paint alternateColorFilterPaint, boolean highQuality) {
|
||||
if (highQuality) mPaint.setColorFilter(getColorFilter());
|
||||
else setColor(alternateColorFilterPaint);
|
||||
}
|
||||
|
||||
public ColorFilter getColorFilter() {
|
||||
@@ -120,6 +120,34 @@ public final class LayeredTileMap {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void setColor(Paint p) {
|
||||
if (colorFilter == null) {
|
||||
p.setARGB(0, 0, 0, 0);
|
||||
return;
|
||||
}
|
||||
switch (colorFilter) {
|
||||
case black20:
|
||||
p.setARGB(51, 0, 0, 0); return;
|
||||
case black40:
|
||||
p.setARGB(102, 0, 0, 0); return;
|
||||
case black60:
|
||||
p.setARGB(153, 0, 0, 0); return;
|
||||
case black80:
|
||||
p.setARGB(204, 0, 0, 0); return;
|
||||
case redtint:
|
||||
p.setARGB(50, 200, 0, 0); return;
|
||||
case greentint:
|
||||
p.setARGB(50, 0, 200, 0); return;
|
||||
case bluetint:
|
||||
p.setARGB(50, 0, 0, 200); return;
|
||||
default:
|
||||
p.setARGB(0, 0, 0, 0); return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static ColorMatrixColorFilter createGrayScaleColorFilter(float blackOpacity) {
|
||||
final float f = blackOpacity;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user