소스 검색

CTRLIO added functionality for exporting palette as 6502 assembly text.

dev
Bryan Miller 5 년 전
부모
커밋
aead6b8485
1개의 변경된 파일12개의 추가작업 그리고 10개의 파일을 삭제
  1. +12
    -10
      app/js/ctrls/CTRLIO.js

+ 12
- 10
app/js/ctrls/CTRLIO.js 파일 보기

function HANDLE_SaveProject(e){ function HANDLE_SaveProject(e){
//var a = document.createElement("a"); //var a = document.createElement("a");
var file = new Blob([JSONFromProject()], {type: "text/plain"}); var file = new Blob([JSONFromProject()], {type: "text/plain"});
RequestDownload("nesproject.json", file);
/*a.href = window.URL.createObjectURL(file);
a.download = "nesproject.json";
var body = document.querySelector("body");
body.appendChild(a);
a.click();
setTimeout(function(){ // fixes firefox html removal bug
window.URL.revokeObjectURL(url);
a.remove();
}, 500);*/
RequestDownload("nesproject.json", file);
} }




GlobalEvents.emit("modal-close"); GlobalEvents.emit("modal-close");
} }


function HANDLE_ExportPalASM(e){
var pal = CTRLPalettesStore.currentPalette;
var palname = CTRLPalettesStore.currentPaletteName.replace(/[^a-z0-9\-_.]/gi, '_');
if (pal !== null && palname !== ""){
var asmtxt = pal.to_asm(palname);
var file = new Blob([asmtxt], {type: "text/plain"});
RequestDownload(palname + ".asm", file);
}
}

function HANDLE_LoadProjectRequest(){ function HANDLE_LoadProjectRequest(){
var input = document.querySelectorAll("input.project-loader"); var input = document.querySelectorAll("input.project-loader");
if (input.length > 0){ if (input.length > 0){
GlobalEvents.listen("change_surface", HANDLE_SurfChange); GlobalEvents.listen("change_surface", HANDLE_SurfChange);
GlobalEvents.listen("save-project", HANDLE_SaveProject); GlobalEvents.listen("save-project", HANDLE_SaveProject);
GlobalEvents.listen("load-project", HANDLE_LoadProjectRequest); GlobalEvents.listen("load-project", HANDLE_LoadProjectRequest);
GlobalEvents.listen("export-pal-asm", HANDLE_ExportPalASM);


var input = document.querySelectorAll("input.project-loader"); var input = document.querySelectorAll("input.project-loader");
if (input.length > 0){ if (input.length > 0){

Loading…
취소
저장