Antialias checkbox

This commit is contained in:
kichikuou
2017-03-12 12:59:30 +09:00
parent 22aea042c7
commit 95b711abb4
3 changed files with 15 additions and 2 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ EMFLAGS += -s TOTAL_MEMORY=134217728
EMFLAGS += -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1
LFLAGS := $(EMFLAGS)
LFLAGS += -s EXPORTED_FUNCTIONS="['_main','_musfade_setvolval_all']"
LFLAGS += -s EXPORTED_FUNCTIONS="['_main','_musfade_setvolval_all','_ags_setAntialiasedStringMode']"
docs/xsystem35.js: emterpretify_whitelist src/xsystem35
$(CC) xsystem35.bc $(LFLAGS) @emterpretify_whitelist -o $@
+3 -1
View File
@@ -37,7 +37,9 @@
<label for="smoothing" class="form-checkbox">
<input type="checkbox" id="smoothing" checked><i class="form-icon"></i>Smoothing
</label>
<label for="antialias" class="form-checkbox">
<input type="checkbox" id="antialias" checked><i class="form-icon"></i>Antialias
</label>
<div id="volume-control">
<i id="volume-control-icon" class="fa fa-volume-up"></i>
<input id="volume-control-slider" type="range">
+11
View File
@@ -2,6 +2,7 @@ var $: (selector:string)=>HTMLElement = document.querySelector.bind(document);
// xsystem35 exported functions
declare function _musfade_setvolval_all(vol: number): void;
declare function _ags_setAntialiasedStringMode(on: number): void;
declare namespace Module {
var noInitialRun: boolean;
@@ -33,6 +34,7 @@ class System35Shell {
status: HTMLElement = document.getElementById('status');
private zoom:ZoomManager;
private volumeControl: VolumeControl;
private antialiasCheckbox: HTMLInputElement;
constructor() {
this.imageLoader = new ImageLoader(this);
@@ -64,6 +66,9 @@ class System35Shell {
this.volumeControl.addEventListener(this.updateVolume.bind(this));
xsystem35.cdPlayer = new CDPlayer(this.imageLoader, this.volumeControl);
this.zoom = new ZoomManager();
this.antialiasCheckbox = <HTMLInputElement>$('#antialias');
this.antialiasCheckbox.addEventListener('change', this.antialiasChanged.bind(this));
this.antialiasCheckbox.checked = localStorage.getItem('antialias') != 'false';
}
run() {
@@ -72,6 +77,7 @@ class System35Shell {
setTimeout(() => {
Module.callMain();
this.updateVolume();
this.antialiasChanged();
}, 0);
}
@@ -98,6 +104,11 @@ class System35Shell {
private updateVolume() {
_musfade_setvolval_all(Math.round(this.volumeControl.volume() * 100));
}
private antialiasChanged() {
localStorage.setItem('antialias', String(this.antialiasCheckbox.checked));
_ags_setAntialiasedStringMode(this.antialiasCheckbox.checked ? 1 : 0);
}
}
class CDPlayer {