mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-22 22:48:08 +03:00
Antialias checkbox
This commit is contained in:
+1
-1
@@ -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
@@ -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">
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user