diff --git a/WWS.js b/WWS.js deleted file mode 100644 index ca8908f..0000000 --- a/WWS.js +++ /dev/null @@ -1,685 +0,0 @@ -/* -JavaScript&HTML5 ゲーム開発用システム -開発 ワールドワイドソフトウェア有限会社 - -(使用条件) -本ソースコードの著作権は開発元にあります。 -利用されたい方はメールにてお問い合わせ下さい。 -th@wwsft.com ワールドワイドソフトウェア 廣瀬 -*/ - -// ---------- グローバル変数 ---------- -var SYS_VER = "Ver.20200730"; -var DEBUG = false; - -//端末の種類 -var deviceType = 0; -var PT_PC = 0; -var PT_iOS = 1; -var PT_Android = 2; -var PT_Kindle = 3; - -//処理の進行を管理 -//main_idxの値↓ -//0: 初期化 -//1: セーブできない警告 -//2: メイン処理 -var main_idx = 0; -var main_tmr = 0; -var stop_flg = 0;//メイン処理の一時停止 - -var NUA = navigator.userAgent;//機種判定 -var supportTouch = 'ontouchend' in document;//タッチイベントが使えるか? -if(DEBUG) {//★★★開発中 - log(NUA); - log(supportTouch); -} - -// ---------- 描画面(キャンバス) ---------- -//サウンドの定義 -var SOUND_ON = true;//サウンドを出力するか - -//キャンバスの初期サイズ -var CWIDTH = 800;//幅 -var CHEIGHT = 600;//高さ - -//フレームレート -var FPS = 30;//1秒間に何回処理を行うか ( frames per second ) - -//ローカルストレージ -var LS_KEYNAME = "SAVEDATA";//keyName 任意に変更可 - -//保存できるか判定し、できない場合に警告を出す 具体的には iOS Safari プライベートブラウズがON(保存できない)状態に警告を出す -var CHECK_LS = false; - -//キー入力用 -var K_ENTER = 13; -var K_SPACE = 32; -var K_LEFT = 37; -var K_UP = 38; -var K_RIGHT = 39; -var K_DOWN = 40; -var K_a = 65; -var K_z = 90; - -// ---------- 描画面(キャンバス) ---------- -var winW, winH; -var bakW, bakH; -var SCALE = 1.0;//スケール値設定+タップ位置計算用 -var cvs = document.getElementById("canvas"); -var bg = cvs.getContext("2d"); - -function initCanvas() {//キャンバス初期設定 - winW = window.innerWidth; - winH = window.innerHeight; - bakW = winW; - bakH = winH; - - if( winH < winW*CHEIGHT/CWIDTH ) { - winW = int(winH*CWIDTH/CHEIGHT); - } - else { - winH = int(CHEIGHT*winW/CWIDTH); - } - cvs.width = winW; - cvs.height = winH; - SCALE = winW / CWIDTH; - bg.scale(SCALE, SCALE); - bg.textAlign = "center"; //┬文字列のセンタリング表示用に必要な値を指定 - bg.textBaseline = "middle";//┘ -// cvs.focus();//キー入力を拾えるようにフォーカスを当てる -} - -function canvasSize(w, h) {//■ユーザー用関数 - CWIDTH = w; - CHEIGHT = h; - initCanvas(); -} - -// ---------- 各種の関数 ---------- -function eID(id) { - return document.getElementById(id); -} - -function log(str) { - console.log(str); -} - -function int(val) {//整数を返す=小数点以下を切り捨て -// return Math.floor(val);//マイナスの場合 -0.1 → -1となるので注意 - return parseInt(val);//こちらはプラスもマイナスも小数部分を切り捨てる -} - -function str(val) {//数を文字列に変換 - return String(val); -} - -function rnd(max) {//乱数 - return int(Math.random()*max); -} - -function abs(val) {//絶対値 - return Math.abs(val); -} - -function sin(a) {//三角関数 - return Math.sin(Math.PI*2*a/360); -} - -function cos(a) { - return Math.cos(Math.PI*2*a/360); -} - -function getDis(x1, y1, x2, y2) {//2点間の距離 - return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); -} - -function digit0(val, leng) { - var s = "0000000000000000" + val; - return s.substring( s.length-leng, s.length ); -} - -function setFPS(val) {//フレームレートの設定 - FPS = val; -} - -//一様乱数 線形合同法で発生させる乱数 -var rndseed = 13; - -//種をセットする -function setRSeed(val) { - rndseed = val; -} - -//乱数を生成 -function rndLCM(max) { - rndseed = (rndseed*109 + 1021) % 65536; - return rndseed%max; -} - -// ---------- キー入力 ---------- -window.addEventListener("keydown", onKey); -window.addEventListener("keyup", offKey); - -var inkey = 0; -var key = new Array(256); - -function clrKey() { - inkey = 0; - for(var i = 0; i < 256; i++) key[i] = 0; -} - -function onKey(e) { - if(snd_init == 0) loadSoundSPhone();//【重要】サウンドの読み込み - inkey = e.keyCode; - key[e.keyCode]++; -//log(inkey); -} - -function offKey(e) { - inkey = 0; - key[e.keyCode] = 0; -} - -// ---------- マウス入力 ---------- -var tapX = 0; -var tapY = 0; -var tapC = 0; - -function mouseDown(e) { - e.preventDefault();//キャンバスの選択/スクロール等を抑制する - var rect = e.target.getBoundingClientRect(); - tapX = e.clientX-rect.left; - tapY = e.clientY-rect.top; - tapC = 1; - transformXY(); - if(snd_init == 0) loadSoundSPhone();//【重要】サウンドの読み込み -} - -function mouseMove(e) { - e.preventDefault(); - var rect = e.target.getBoundingClientRect(); - tapX = e.clientX-rect.left; - tapY = e.clientY-rect.top; - transformXY(); -} - -function mouseUp(e) { tapC = 0; } -function mouseOut(e) { tapC = 0; } - -// ---------- タップ入力 ---------- -function touchStart(e) { - e.preventDefault();//キャンバスの選択/スクロール等を抑制する - var rect = e.target.getBoundingClientRect(); - tapX = e.touches[0].clientX-rect.left; - tapY = e.touches[0].clientY-rect.top; - tapC = 1; - transformXY(); - if(snd_init == 0) loadSoundSPhone();//【重要】サウンドの読み込み -} - -function touchMove(e) { - e.preventDefault(); - var rect = e.target.getBoundingClientRect(); - tapX = e.touches[0].clientX-rect.left; - tapY = e.touches[0].clientY-rect.top; - transformXY(); -} - -function touchEnd(e) { - e.preventDefault(); - tapC = 0;//※マウス操作ではmouseOutがこれになる -} - -function touchCancel(e) { - tapX = -1; - tapY = -1; - tapC = 0; -} - -function transformXY() {//実座標→仮想座標への変換 - tapX = int(tapX/SCALE); - tapY = int(tapY/SCALE); -} - -// ---------- 加速度センサー ---------- -var acX = 0, acY = 0, acZ = 0; - -//window.ondevicemotion = deviceMotion;//★★★旧 -window.addEventListener("devicemotion", deviceMotion); - -function deviceMotion(e) { - var aIG = e.accelerationIncludingGravity; - acX = int(aIG.x); - acY = int(aIG.y); - acZ = int(aIG.z); - if(deviceType == PT_Android) {//Android と iOS で正負が逆になる - acX = -acX; - acY = -acY; - acZ = -acZ; - } -} - -// ---------- 画像読み込み ---------- -var img = new Array(256); -var img_loaded = new Array(256); - -function loadImg(n, filename) { -// log("画像"+n+" "+filename+" 読込開始"); - img_loaded[n] = false;//読み込み開始 - img[n] = new Image(); - img[n].onload = function() { -// log("画像"+n+" "+filename+" 読込完了"); - img_loaded[n] = true; - } - img[n].src = filename; -} - -// ---------- サウンド制御 ---------- -var snd_init = 0;//サウンドファイルを読み込んだか(スマートフォン対策) - -var soundfile = new Array(256); -var isBgm = -1; -var bgmNo = 0; -var wait_se = 0; -var seNo = -1; - -var soundloaded = 0;//いくつファイルを読み込んだか -var sf_name = new Array(256); - -function loadSoundSPhone() {//スマートフォンでサウンドファイルを読み込む - for(var i = 0; i < soundloaded; i++) { - try { - soundfile[i] = new Audio(sf_name[i]); - soundfile[i].load(); -// log("サウンド読み込みSP"+i); - } catch(e) {} - } - snd_init = 2;//スマホでサウンドを読み込んだ -} - -function loadSound(n, filename) { -// if(deviceType == PT_PC) { -// try { -// soundfile[n] = new Audio(filename); -// soundfile[n].load(); -// log("サウンド読み込みPC"+n); -// } catch(e) {} -// snd_init = 1;//パソコンでサウンドを読み込んだ -// } -// else { - sf_name[n] = filename; -// } - soundloaded++; -} - -function playSE(n) { - if(SOUND_ON == false) return; - if(isBgm == 2) return; - if(wait_se == 0) { - seNo = n; - soundfile[n].currentTime = 0; - soundfile[n].loop = false; - soundfile[n].play(); - wait_se = 3;//ブラウザに負荷をかけないため連続して流さないようにする - } -} - -function playBgm(n) { - if(SOUND_ON == false) return; - log("BGM"+n+"出力"); - bgmNo = n; - soundfile[n].loop = true; - soundfile[n].play(); - isBgm = 1;//BGM流れている -} - -function pauseBgm() { - soundfile[bgmNo].pause(); - isBgm = 0;//BGM停止している -} - -function stopBgm() { - soundfile[bgmNo].pause(); - soundfile[bgmNo].currentTime = 0; - isBgm = 0;//BGM停止している -} - -function rateSnd(rate) {//曲の速度 - soundfile[bgmNo].playbackRate = rate; -} - -//ブラウザを隠した時に音を一時停止する処理 -document.addEventListener("visibilitychange", vcProc); - -function vcProc() { - log("visibilitychange"); - if(document.visibilityState == "hidden") { - stop_flg = 1; - if(isBgm == 1) { - pauseBgm(); - isBgm = 2;//BGM再出力待ち - } - } - else if(document.visibilityState == "visible") { - stop_flg = 0; - if(isBgm == 2) playBgm(bgmNo); - } -} - -// ---------- ローカルストレージ ---------- -//【開発メモ】 -//ローカルストレージへのアクセスができない状態(具体的にはSafariでプライベートブラウズになっている時) try catch が入っていないとフリーズする -//7 C:\Users\ユーザ名\AppData\Local\Google\Chrome\User Data\Default\Local Storage -// -function saveLS(kno, val) { - try { - localStorage.setItem(LS_KEYNAME+kno, val); - } - catch(e) {} -} - -function loadLS(kno) {//文字列、数値をそのまま保存し、元の状態(型)で読み込めるようにしてある - var val = null; - try { - val = localStorage.getItem(LS_KEYNAME+kno); - } - catch(e) {} - if(val == null) return val; - if(val == "") return val; - if(isNaN(val) == true) return val; - //↑以上、文字列 - return Number(val); -} - -function clrLS(kno) { - localStorage.removeItem(LS_KEYNAME+kno); -} - -// ---------- 描画1 図形 ---------- -function setAlp(per) { - bg.globalAlpha = per/100;//【メモ】HTML5は0.0~1.0の値で指定 -} - -function colorRGB(cr, cg, cb) { - cr = int(cr);//【開発メモ】少数を渡すとおかしくなるので整数にしておく - cg = int(cg); - cb = int(cb); - return ("rgb("+cr+","+cg+","+cb+")"); -} - -function lineW(wid) {//線の太さを指定 - bg.lineWidth = wid; - bg.lineCap = "round";//線の先端を丸める指定 - bg.lineJoin = "round";//線の接続部分を丸める指定 -} - -function line(x0, y0, x1, y1, col) {//線 - bg.strokeStyle = col; - bg.beginPath(); - bg.moveTo(x0, y0); - bg.lineTo(x1, y1); - bg.stroke(); -} - -function fill(col) {//キャンバス全体の塗り潰し - bg.fillStyle = col; - bg.fillRect(0, 0, CWIDTH, CHEIGHT); -} - -function fRect(x, y, w, h, col) {//矩形(塗り潰し) - bg.fillStyle = col; - bg.fillRect(x, y, w, h); -} - -function sRect(x, y, w, h, col) {//矩形(線) - bg.strokeStyle = col; - bg.strokeRect(x, y, w, h); -} - -function fCir(x, y, r, col) {//円(塗り潰し) - bg.fillStyle = col; - bg.beginPath(); - bg.arc(x, y, r, 0, Math.PI*2, false); - bg.closePath(); - bg.fill(); -} -function sCir(x, y, r, col) {//円(線) - bg.strokeStyle = col; - bg.beginPath(); - bg.arc(x, y, r, 0, Math.PI*2, false); - bg.closePath(); - bg.stroke(); -} - -function fTri(x0, y0, x1, y1, x2, y2, col) {//三角(塗り潰し) - bg.fillStyle = col; - bg.beginPath(); - bg.moveTo(x0, y0); - bg.lineTo(x1, y1); - bg.lineTo(x2, y2); - bg.closePath(); - bg.fill(); -} - -function sTri(x0, y0, x1, y1, x2, y2, col) {//三角(線) - bg.strokeStyle = col; - bg.beginPath(); - bg.moveTo(x0, y0); - bg.lineTo(x1, y1); - bg.lineTo(x2, y2); - bg.closePath(); - bg.stroke(); -} - -function fPol(xy, col) {//多角形(塗り潰し) - bg.fillStyle = col; - bg.beginPath(); - bg.moveTo(xy[0], xy[1]); - for(var i=2; i 0) wait_se--; - break; - - } - - var ptime = Date.now() - stime; - if(ptime < 0) ptime = 0; - if(ptime > int(1000/FPS)) ptime = int(1000/FPS); - - if(DEBUG) {//★★★デバッグ - var i, x = 240, y; - fText("処理時間="+(ptime), x, 50, 16, "lime"); - fText("deviceType="+deviceType, x, 100, 16, "yellow"); - fText("isBgm="+isBgm+"("+bgmNo+")", x, 150, 16, "yellow"); - fText("winW="+winW+" winH="+winH+" SCALE="+SCALE, x, 200, 16, "yellow"); - fText(main_idx+":"+main_tmr+"("+tapX+","+tapY+")"+tapC, x, 250, 16, "cyan"); - fText("加速度 "+acX + " : " + acY + " : " + acZ, x, 300, 16, "pink"); - for(i = 0; i < 256; i++) { - x = i%16; - y = int(i/16); - fText(key[i], 15+30*x, 15+30*y, 12, "white"); - } - } - - setTimeout("wwsSysMain()", int(1000/FPS)-ptime); -} - -// ---------- 起動処理 ---------- -//window.onload = function() {} - -window.addEventListener("load", wwsSysInit); - -function wwsSysInit() { - - initCanvas(); - - if( NUA.indexOf('Android') > 0 ) { - deviceType = PT_Android; - } - else if( NUA.indexOf('iPhone') > 0 || NUA.indexOf('iPod') > 0 || NUA.indexOf('iPad') > 0 ) { - deviceType = PT_iOS; - window.scrollTo(0,1);//iPhoneのURLバーを消す位置に - } - else if( NUA.indexOf('Silk') > 0 ) { - deviceType = PT_Kindle; - } - - //イベントリスナー(タップ判定) - if(supportTouch == true) { - cvs.addEventListener("touchstart", touchStart); - cvs.addEventListener("touchmove", touchMove); - cvs.addEventListener("touchend", touchEnd); - cvs.addEventListener("touchcancel", touchCancel); - } - else { - cvs.addEventListener("mousedown", mouseDown); - cvs.addEventListener("mousemove", mouseMove); - cvs.addEventListener("mouseup", mouseUp); - cvs.addEventListener("mouseout", mouseOut); - } - - wwsSysMain();//リアルタイム処理を開始 -} diff --git a/beautyVote.js b/beautyVote.js deleted file mode 100644 index 2d850b8..0000000 --- a/beautyVote.js +++ /dev/null @@ -1,220 +0,0 @@ - -class Question{ - constructor(){ - this.question = 0; - this.answer = 0; - this.choiceA = 0; - this.choiceB = 0; - this.choiceC = 0; - this.choiceD = 0; - } - join(question, answer, choiceA, choiceB, choiceC, choiceD){ - this.question = question; - this.answer = answer; - this.choiceA = choiceA; - this.choiceB = choiceB; - this.choiceC = choiceC; - this.choiceD = choiceD; - } - getQustion(){ - return this.question; - } - getAnswer(){ - return this.answer; - } - getChoice(idx){ - return this.choices[idx]; - } - -} - - - - -class Player{ - constructor(){ - this.points = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; - this.choice = 0; - } - calcScore(){ - var score = 0; - for(var i = 0; i < MAX_ROUND; i ++){ - if(this.points[i] == CORRECT){ - score ++; - } - } - return score; - } -} - - - -function setup(){ - canvasSize(960, 1200); - lineW(3); - //loadImg(0, "image/bg.png"); - timer = 0; - setQuestion(round); -} - - -function mainloop(){ - - switch(scene){ - case 1: - if(timer < 900){ - timer ++; - } - fill("silver"); - setAlp(50); - fRect(50, 50, 855, 100, "black"); - fText("Q.", 110, 100, 50, "white"); - fRect(45, 295, 865, 560, "white"); - fRect(50, 300, 400, 250, "black"); - fRect(500, 300, 400, 250, "black"); - fRect(50, 600, 400, 250, "black"); - fRect(500, 600, 400, 250, "black"); - - sRect(45, 880, 865, 40, "black"); - fRect(45, 880, (timer/900)*865, 40, "red"); - setAlp(100); - - - fText("A.", 100, 425, 40, "white"); - fText("B.", 550, 425, 40, "white"); - fText("C.", 100, 725, 40, "white"); - fText("D.", 550, 725, 40, "white"); - - fText(question[round].question, 480, 100, 30, "white"); - fText(question[round].choiceA, 275, 425, 25, "white"); - fText(question[round].choiceB, 725, 425, 25, "white"); - fText(question[round].choiceC, 275, 725, 25, "white"); - fText(question[round].choiceD, 725, 725, 25, "white"); - - fText(int(timer/30), 900, 1100, 50, "red"); - - setAlp(50); - - fText((round+1) + "回戦", 100, 1000, 50, "red"); - for(var i = 0; i < MAX_ROUND; i ++){ - if(player.points[i] == CORRECT){ - fText("O", 480 + 50*i, 1000, 50, "red"); - } - else if(player.points[i] == WRONG) { - fText("X", 480 + 50*i, 1000, 50, "blue"); - } - else{ - fText("*", 480 + 50*i, 1000, 50, "black"); - } - } - - if(round >= MAX_ROUND){ - fText("あなたのスコアは" + player.calcScore() + "点です", 480, 600, 80, "gold"); - } - - if(tapC == 1){ - tapC ++; - - if(round < MAX_ROUND){ - if(50 <= tapX && tapX <= 450 && 300 <= tapY && tapY <= 550){ - player.choice = A; - checkAnswer(); - scene = 2; - } - else if(500 <= tapX && tapX <= 900 && 300 <= tapY && tapY <= 550){ - player.choice = B; - checkAnswer(); - } - else if(50 <= tapX && tapX <= 450 && 600 <= tapY && tapY <= 850){ - player.choice = C; - checkAnswer(); - } - else if(500 <= tapX && tapX <= 900 && 600 <= tapY && tapY <= 850){ - player.choice = D; - checkAnswer(); - } - } - } - break; - case 2: - showResult(); - } -} - - - - -function setQuestion(round){ - question[round].join(questions[round], answer[round], choices[round][A], choices[round][B], choices[round][C], choices[round][D]); -} - - -function checkAnswer(){ - if(player.choice == question[round].answer){ - player.points[round] = CORRECT; - } - else{ - player.points[round] = WRONG; - } - timer = 0; - round ++; - if(round < MAX_ROUND){ - setQuestion(round); - } -} - - -var round = 0; -var MAX_ROUND = 10; - -var timer = 0; -var select = 0; - -var A = 0; -var B = 1; -var C = 2; -var D = 3; -var CORRECT = 1; -var WRONG = 0; - -var scene = 1; - -var BLOCK_SIZE = 5; -var my_order = 8; -var ranking_order = ["ルフィ", "ゾロ", "ジンベエ", "サンジ", "ロビン", "ウソップ", "フランキー", "ブルック", "ナミ", "チョッパー"] -var scoreing_order = [3000000000,1110000000, 1100000000, 1032000000, 930000000, 500000000, 394000000, 383000000, 366000000, 1000] -var MAX_ORDER = 10; - -var question = new Array(MAX_ROUND); -for(var i = 0; i < MAX_ROUND+1; i ++){ - question[i] = new Question(); -} - -var player = new Player(); - - -var questions = ["「にっこり」の対義語は?", - "もっとも年齢が高いのは?", - "中国語で「勉強」意味は?", - "焼き肉の「テッポウ」はどこの部位?", - "アフリカ大陸でもっとも面積が大きい国は?", - "実在する生き物は?", - "カスタネットの名前の由来となったものは?", - "名前が人物に由来しているのは?", - "ジンベイザメは英語で何シャーク?", - "心臓がない生き物は?"]; - -var answer = [C, A, B, B, C, C, C, C, B, B]; - -var choices = [["がっくり", "げっそり", "むっつり", "しっとり"], - ["ドナルド・トランプ", "ボリス・ジョンソン", "ウラジーミル・プーチン", "アンゲラ・メルケル"], - ["喧嘩っ早い", "無理やり", "細かい", "意地悪な"], - ["食道", "直腸", "こめかみ", "胃袋"], - ["エチオピア", "リビア", "アルジェリア", "ケニア"], - ["キリンコウモリ", "ライオンコウモリ", "ウサギコウモリ", "オオカミコウモリ"], - ["ハサミの刃", "貝の殻", "栗の実", "両手"], - ["そら豆", "えんどう豆", "いんげん豆", "ひよこ豆"], - ["エレファント", "ホエール", "ダイナソー", "メガ"], - ["カニ", "ナマコ", "タコ", "ホタテ"]]; - - diff --git a/flask/server.py b/flask/server.py new file mode 100644 index 0000000..562a19f --- /dev/null +++ b/flask/server.py @@ -0,0 +1,4 @@ +from testapp import app + +if __name__ == "__main__": + app.run() diff --git a/flask/testapp/__init__.py b/flask/testapp/__init__.py new file mode 100644 index 0000000..5b9ca1a --- /dev/null +++ b/flask/testapp/__init__.py @@ -0,0 +1,6 @@ +from flask import Flask + +app = Flask(__name__) +app.config.from_object("testapp.config") # 追加 + +import testapp.views diff --git a/flask/testapp/config.py b/flask/testapp/config.py new file mode 100644 index 0000000..51c64dd --- /dev/null +++ b/flask/testapp/config.py @@ -0,0 +1 @@ +DEBUG = True diff --git a/flask/testapp/static/javascript/WWS.js b/flask/testapp/static/javascript/WWS.js new file mode 100644 index 0000000..ca8908f --- /dev/null +++ b/flask/testapp/static/javascript/WWS.js @@ -0,0 +1,685 @@ +/* +JavaScript&HTML5 ゲーム開発用システム +開発 ワールドワイドソフトウェア有限会社 + +(使用条件) +本ソースコードの著作権は開発元にあります。 +利用されたい方はメールにてお問い合わせ下さい。 +th@wwsft.com ワールドワイドソフトウェア 廣瀬 +*/ + +// ---------- グローバル変数 ---------- +var SYS_VER = "Ver.20200730"; +var DEBUG = false; + +//端末の種類 +var deviceType = 0; +var PT_PC = 0; +var PT_iOS = 1; +var PT_Android = 2; +var PT_Kindle = 3; + +//処理の進行を管理 +//main_idxの値↓ +//0: 初期化 +//1: セーブできない警告 +//2: メイン処理 +var main_idx = 0; +var main_tmr = 0; +var stop_flg = 0;//メイン処理の一時停止 + +var NUA = navigator.userAgent;//機種判定 +var supportTouch = 'ontouchend' in document;//タッチイベントが使えるか? +if(DEBUG) {//★★★開発中 + log(NUA); + log(supportTouch); +} + +// ---------- 描画面(キャンバス) ---------- +//サウンドの定義 +var SOUND_ON = true;//サウンドを出力するか + +//キャンバスの初期サイズ +var CWIDTH = 800;//幅 +var CHEIGHT = 600;//高さ + +//フレームレート +var FPS = 30;//1秒間に何回処理を行うか ( frames per second ) + +//ローカルストレージ +var LS_KEYNAME = "SAVEDATA";//keyName 任意に変更可 + +//保存できるか判定し、できない場合に警告を出す 具体的には iOS Safari プライベートブラウズがON(保存できない)状態に警告を出す +var CHECK_LS = false; + +//キー入力用 +var K_ENTER = 13; +var K_SPACE = 32; +var K_LEFT = 37; +var K_UP = 38; +var K_RIGHT = 39; +var K_DOWN = 40; +var K_a = 65; +var K_z = 90; + +// ---------- 描画面(キャンバス) ---------- +var winW, winH; +var bakW, bakH; +var SCALE = 1.0;//スケール値設定+タップ位置計算用 +var cvs = document.getElementById("canvas"); +var bg = cvs.getContext("2d"); + +function initCanvas() {//キャンバス初期設定 + winW = window.innerWidth; + winH = window.innerHeight; + bakW = winW; + bakH = winH; + + if( winH < winW*CHEIGHT/CWIDTH ) { + winW = int(winH*CWIDTH/CHEIGHT); + } + else { + winH = int(CHEIGHT*winW/CWIDTH); + } + cvs.width = winW; + cvs.height = winH; + SCALE = winW / CWIDTH; + bg.scale(SCALE, SCALE); + bg.textAlign = "center"; //┬文字列のセンタリング表示用に必要な値を指定 + bg.textBaseline = "middle";//┘ +// cvs.focus();//キー入力を拾えるようにフォーカスを当てる +} + +function canvasSize(w, h) {//■ユーザー用関数 + CWIDTH = w; + CHEIGHT = h; + initCanvas(); +} + +// ---------- 各種の関数 ---------- +function eID(id) { + return document.getElementById(id); +} + +function log(str) { + console.log(str); +} + +function int(val) {//整数を返す=小数点以下を切り捨て +// return Math.floor(val);//マイナスの場合 -0.1 → -1となるので注意 + return parseInt(val);//こちらはプラスもマイナスも小数部分を切り捨てる +} + +function str(val) {//数を文字列に変換 + return String(val); +} + +function rnd(max) {//乱数 + return int(Math.random()*max); +} + +function abs(val) {//絶対値 + return Math.abs(val); +} + +function sin(a) {//三角関数 + return Math.sin(Math.PI*2*a/360); +} + +function cos(a) { + return Math.cos(Math.PI*2*a/360); +} + +function getDis(x1, y1, x2, y2) {//2点間の距離 + return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); +} + +function digit0(val, leng) { + var s = "0000000000000000" + val; + return s.substring( s.length-leng, s.length ); +} + +function setFPS(val) {//フレームレートの設定 + FPS = val; +} + +//一様乱数 線形合同法で発生させる乱数 +var rndseed = 13; + +//種をセットする +function setRSeed(val) { + rndseed = val; +} + +//乱数を生成 +function rndLCM(max) { + rndseed = (rndseed*109 + 1021) % 65536; + return rndseed%max; +} + +// ---------- キー入力 ---------- +window.addEventListener("keydown", onKey); +window.addEventListener("keyup", offKey); + +var inkey = 0; +var key = new Array(256); + +function clrKey() { + inkey = 0; + for(var i = 0; i < 256; i++) key[i] = 0; +} + +function onKey(e) { + if(snd_init == 0) loadSoundSPhone();//【重要】サウンドの読み込み + inkey = e.keyCode; + key[e.keyCode]++; +//log(inkey); +} + +function offKey(e) { + inkey = 0; + key[e.keyCode] = 0; +} + +// ---------- マウス入力 ---------- +var tapX = 0; +var tapY = 0; +var tapC = 0; + +function mouseDown(e) { + e.preventDefault();//キャンバスの選択/スクロール等を抑制する + var rect = e.target.getBoundingClientRect(); + tapX = e.clientX-rect.left; + tapY = e.clientY-rect.top; + tapC = 1; + transformXY(); + if(snd_init == 0) loadSoundSPhone();//【重要】サウンドの読み込み +} + +function mouseMove(e) { + e.preventDefault(); + var rect = e.target.getBoundingClientRect(); + tapX = e.clientX-rect.left; + tapY = e.clientY-rect.top; + transformXY(); +} + +function mouseUp(e) { tapC = 0; } +function mouseOut(e) { tapC = 0; } + +// ---------- タップ入力 ---------- +function touchStart(e) { + e.preventDefault();//キャンバスの選択/スクロール等を抑制する + var rect = e.target.getBoundingClientRect(); + tapX = e.touches[0].clientX-rect.left; + tapY = e.touches[0].clientY-rect.top; + tapC = 1; + transformXY(); + if(snd_init == 0) loadSoundSPhone();//【重要】サウンドの読み込み +} + +function touchMove(e) { + e.preventDefault(); + var rect = e.target.getBoundingClientRect(); + tapX = e.touches[0].clientX-rect.left; + tapY = e.touches[0].clientY-rect.top; + transformXY(); +} + +function touchEnd(e) { + e.preventDefault(); + tapC = 0;//※マウス操作ではmouseOutがこれになる +} + +function touchCancel(e) { + tapX = -1; + tapY = -1; + tapC = 0; +} + +function transformXY() {//実座標→仮想座標への変換 + tapX = int(tapX/SCALE); + tapY = int(tapY/SCALE); +} + +// ---------- 加速度センサー ---------- +var acX = 0, acY = 0, acZ = 0; + +//window.ondevicemotion = deviceMotion;//★★★旧 +window.addEventListener("devicemotion", deviceMotion); + +function deviceMotion(e) { + var aIG = e.accelerationIncludingGravity; + acX = int(aIG.x); + acY = int(aIG.y); + acZ = int(aIG.z); + if(deviceType == PT_Android) {//Android と iOS で正負が逆になる + acX = -acX; + acY = -acY; + acZ = -acZ; + } +} + +// ---------- 画像読み込み ---------- +var img = new Array(256); +var img_loaded = new Array(256); + +function loadImg(n, filename) { +// log("画像"+n+" "+filename+" 読込開始"); + img_loaded[n] = false;//読み込み開始 + img[n] = new Image(); + img[n].onload = function() { +// log("画像"+n+" "+filename+" 読込完了"); + img_loaded[n] = true; + } + img[n].src = filename; +} + +// ---------- サウンド制御 ---------- +var snd_init = 0;//サウンドファイルを読み込んだか(スマートフォン対策) + +var soundfile = new Array(256); +var isBgm = -1; +var bgmNo = 0; +var wait_se = 0; +var seNo = -1; + +var soundloaded = 0;//いくつファイルを読み込んだか +var sf_name = new Array(256); + +function loadSoundSPhone() {//スマートフォンでサウンドファイルを読み込む + for(var i = 0; i < soundloaded; i++) { + try { + soundfile[i] = new Audio(sf_name[i]); + soundfile[i].load(); +// log("サウンド読み込みSP"+i); + } catch(e) {} + } + snd_init = 2;//スマホでサウンドを読み込んだ +} + +function loadSound(n, filename) { +// if(deviceType == PT_PC) { +// try { +// soundfile[n] = new Audio(filename); +// soundfile[n].load(); +// log("サウンド読み込みPC"+n); +// } catch(e) {} +// snd_init = 1;//パソコンでサウンドを読み込んだ +// } +// else { + sf_name[n] = filename; +// } + soundloaded++; +} + +function playSE(n) { + if(SOUND_ON == false) return; + if(isBgm == 2) return; + if(wait_se == 0) { + seNo = n; + soundfile[n].currentTime = 0; + soundfile[n].loop = false; + soundfile[n].play(); + wait_se = 3;//ブラウザに負荷をかけないため連続して流さないようにする + } +} + +function playBgm(n) { + if(SOUND_ON == false) return; + log("BGM"+n+"出力"); + bgmNo = n; + soundfile[n].loop = true; + soundfile[n].play(); + isBgm = 1;//BGM流れている +} + +function pauseBgm() { + soundfile[bgmNo].pause(); + isBgm = 0;//BGM停止している +} + +function stopBgm() { + soundfile[bgmNo].pause(); + soundfile[bgmNo].currentTime = 0; + isBgm = 0;//BGM停止している +} + +function rateSnd(rate) {//曲の速度 + soundfile[bgmNo].playbackRate = rate; +} + +//ブラウザを隠した時に音を一時停止する処理 +document.addEventListener("visibilitychange", vcProc); + +function vcProc() { + log("visibilitychange"); + if(document.visibilityState == "hidden") { + stop_flg = 1; + if(isBgm == 1) { + pauseBgm(); + isBgm = 2;//BGM再出力待ち + } + } + else if(document.visibilityState == "visible") { + stop_flg = 0; + if(isBgm == 2) playBgm(bgmNo); + } +} + +// ---------- ローカルストレージ ---------- +//【開発メモ】 +//ローカルストレージへのアクセスができない状態(具体的にはSafariでプライベートブラウズになっている時) try catch が入っていないとフリーズする +//7 C:\Users\ユーザ名\AppData\Local\Google\Chrome\User Data\Default\Local Storage +// +function saveLS(kno, val) { + try { + localStorage.setItem(LS_KEYNAME+kno, val); + } + catch(e) {} +} + +function loadLS(kno) {//文字列、数値をそのまま保存し、元の状態(型)で読み込めるようにしてある + var val = null; + try { + val = localStorage.getItem(LS_KEYNAME+kno); + } + catch(e) {} + if(val == null) return val; + if(val == "") return val; + if(isNaN(val) == true) return val; + //↑以上、文字列 + return Number(val); +} + +function clrLS(kno) { + localStorage.removeItem(LS_KEYNAME+kno); +} + +// ---------- 描画1 図形 ---------- +function setAlp(per) { + bg.globalAlpha = per/100;//【メモ】HTML5は0.0~1.0の値で指定 +} + +function colorRGB(cr, cg, cb) { + cr = int(cr);//【開発メモ】少数を渡すとおかしくなるので整数にしておく + cg = int(cg); + cb = int(cb); + return ("rgb("+cr+","+cg+","+cb+")"); +} + +function lineW(wid) {//線の太さを指定 + bg.lineWidth = wid; + bg.lineCap = "round";//線の先端を丸める指定 + bg.lineJoin = "round";//線の接続部分を丸める指定 +} + +function line(x0, y0, x1, y1, col) {//線 + bg.strokeStyle = col; + bg.beginPath(); + bg.moveTo(x0, y0); + bg.lineTo(x1, y1); + bg.stroke(); +} + +function fill(col) {//キャンバス全体の塗り潰し + bg.fillStyle = col; + bg.fillRect(0, 0, CWIDTH, CHEIGHT); +} + +function fRect(x, y, w, h, col) {//矩形(塗り潰し) + bg.fillStyle = col; + bg.fillRect(x, y, w, h); +} + +function sRect(x, y, w, h, col) {//矩形(線) + bg.strokeStyle = col; + bg.strokeRect(x, y, w, h); +} + +function fCir(x, y, r, col) {//円(塗り潰し) + bg.fillStyle = col; + bg.beginPath(); + bg.arc(x, y, r, 0, Math.PI*2, false); + bg.closePath(); + bg.fill(); +} +function sCir(x, y, r, col) {//円(線) + bg.strokeStyle = col; + bg.beginPath(); + bg.arc(x, y, r, 0, Math.PI*2, false); + bg.closePath(); + bg.stroke(); +} + +function fTri(x0, y0, x1, y1, x2, y2, col) {//三角(塗り潰し) + bg.fillStyle = col; + bg.beginPath(); + bg.moveTo(x0, y0); + bg.lineTo(x1, y1); + bg.lineTo(x2, y2); + bg.closePath(); + bg.fill(); +} + +function sTri(x0, y0, x1, y1, x2, y2, col) {//三角(線) + bg.strokeStyle = col; + bg.beginPath(); + bg.moveTo(x0, y0); + bg.lineTo(x1, y1); + bg.lineTo(x2, y2); + bg.closePath(); + bg.stroke(); +} + +function fPol(xy, col) {//多角形(塗り潰し) + bg.fillStyle = col; + bg.beginPath(); + bg.moveTo(xy[0], xy[1]); + for(var i=2; i 0) wait_se--; + break; + + } + + var ptime = Date.now() - stime; + if(ptime < 0) ptime = 0; + if(ptime > int(1000/FPS)) ptime = int(1000/FPS); + + if(DEBUG) {//★★★デバッグ + var i, x = 240, y; + fText("処理時間="+(ptime), x, 50, 16, "lime"); + fText("deviceType="+deviceType, x, 100, 16, "yellow"); + fText("isBgm="+isBgm+"("+bgmNo+")", x, 150, 16, "yellow"); + fText("winW="+winW+" winH="+winH+" SCALE="+SCALE, x, 200, 16, "yellow"); + fText(main_idx+":"+main_tmr+"("+tapX+","+tapY+")"+tapC, x, 250, 16, "cyan"); + fText("加速度 "+acX + " : " + acY + " : " + acZ, x, 300, 16, "pink"); + for(i = 0; i < 256; i++) { + x = i%16; + y = int(i/16); + fText(key[i], 15+30*x, 15+30*y, 12, "white"); + } + } + + setTimeout("wwsSysMain()", int(1000/FPS)-ptime); +} + +// ---------- 起動処理 ---------- +//window.onload = function() {} + +window.addEventListener("load", wwsSysInit); + +function wwsSysInit() { + + initCanvas(); + + if( NUA.indexOf('Android') > 0 ) { + deviceType = PT_Android; + } + else if( NUA.indexOf('iPhone') > 0 || NUA.indexOf('iPod') > 0 || NUA.indexOf('iPad') > 0 ) { + deviceType = PT_iOS; + window.scrollTo(0,1);//iPhoneのURLバーを消す位置に + } + else if( NUA.indexOf('Silk') > 0 ) { + deviceType = PT_Kindle; + } + + //イベントリスナー(タップ判定) + if(supportTouch == true) { + cvs.addEventListener("touchstart", touchStart); + cvs.addEventListener("touchmove", touchMove); + cvs.addEventListener("touchend", touchEnd); + cvs.addEventListener("touchcancel", touchCancel); + } + else { + cvs.addEventListener("mousedown", mouseDown); + cvs.addEventListener("mousemove", mouseMove); + cvs.addEventListener("mouseup", mouseUp); + cvs.addEventListener("mouseout", mouseOut); + } + + wwsSysMain();//リアルタイム処理を開始 +} diff --git a/flask/testapp/static/javascript/beautyVote.js b/flask/testapp/static/javascript/beautyVote.js new file mode 100644 index 0000000..ba67e70 --- /dev/null +++ b/flask/testapp/static/javascript/beautyVote.js @@ -0,0 +1,244 @@ + +class Question{ + constructor(){ + this.question = 0; + this.answer = 0; + this.choiceA = 0; + this.choiceB = 0; + this.choiceC = 0; + this.choiceD = 0; + } + join(question, answer, choiceA, choiceB, choiceC, choiceD){ + this.question = question; + this.answer = answer; + this.choiceA = choiceA; + this.choiceB = choiceB; + this.choiceC = choiceC; + this.choiceD = choiceD; + } + getQustion(){ + return this.question; + } + getAnswer(){ + return this.answer; + } + getChoice(idx){ + return this.choices[idx]; + } + +} + + + + +class Player{ + constructor(){ + this.points = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; + this.choice = 0; + } + calcScore(){ + var score = 0; + for(var i = 0; i < MAX_ROUND; i ++){ + if(this.points[i] == CORRECT){ + score ++; + } + } + return score; + } +} + + + +function setup(){ + canvasSize(960, 1200); + lineW(3); + //loadImg(0, "image/bg.png"); + timer = 0; + setQuestion(round); +} + + +function mainloop(){ + + switch(scene){ + case 1: + if(timer < 900){ + timer ++; + } + fill("silver"); + setAlp(50); + fRect(50, 50, 855, 100, "black"); + fText("Q.", 110, 100, 50, "white"); + fRect(45, 295, 865, 560, "white"); + fRect(50, 300, 400, 250, "black"); + fRect(500, 300, 400, 250, "black"); + fRect(50, 600, 400, 250, "black"); + fRect(500, 600, 400, 250, "black"); + + sRect(45, 880, 865, 40, "black"); + fRect(45, 880, (timer/900)*865, 40, "red"); + setAlp(100); + + + fText("A.", 100, 425, 40, "white"); + fText("B.", 550, 425, 40, "white"); + fText("C.", 100, 725, 40, "white"); + fText("D.", 550, 725, 40, "white"); + + fText(question[round].question, 480, 100, 30, "white"); + fText(question[round].choiceA, 275, 425, 25, "white"); + fText(question[round].choiceB, 725, 425, 25, "white"); + fText(question[round].choiceC, 275, 725, 25, "white"); + fText(question[round].choiceD, 725, 725, 25, "white"); + + fText(int(timer/30), 900, 1100, 50, "red"); + + setAlp(50); + + fText((round+1) + "回戦", 100, 1000, 50, "red"); + for(var i = 0; i < MAX_ROUND; i ++){ + if(player.points[i] == CORRECT){ + fText("O", 480 + 50*i, 1000, 50, "red"); + } + else if(player.points[i] == WRONG) { + fText("X", 480 + 50*i, 1000, 50, "blue"); + } + else{ + fText("*", 480 + 50*i, 1000, 50, "black"); + } + } + + if(round >= MAX_ROUND){ + fText("あなたのスコアは" + player.calcScore() + "点です", 480, 600, 80, "gold"); + } + + if(tapC == 1){ + tapC ++; + + if(round < MAX_ROUND){ + if(50 <= tapX && tapX <= 450 && 300 <= tapY && tapY <= 550){ + player.choice = A; + checkAnswer(); + scene = 2; + } + else if(500 <= tapX && tapX <= 900 && 300 <= tapY && tapY <= 550){ + player.choice = B; + checkAnswer(); + } + else if(50 <= tapX && tapX <= 450 && 600 <= tapY && tapY <= 850){ + player.choice = C; + checkAnswer(); + } + else if(500 <= tapX && tapX <= 900 && 600 <= tapY && tapY <= 850){ + player.choice = D; + checkAnswer(); + } + postForm(player.choice) // 送信用 + } + } + break; + case 2: + showResult(); + } +} + + + + +function setQuestion(round){ + question[round].join(questions[round], answer[round], choices[round][A], choices[round][B], choices[round][C], choices[round][D]); +} + + +function checkAnswer(){ + if(player.choice == question[round].answer){ + player.points[round] = CORRECT; + } + else{ + player.points[round] = WRONG; + } + timer = 0; + round ++; + if(round < MAX_ROUND){ + setQuestion(round); + } +} + + +// 送信用 +function postForm(value) { + + var form = document.createElement('form'); + var request = document.createElement('input'); + + form.method = 'POST'; + form.action = '/form'; + + request.type = 'hidden'; //入力フォームが表示されないように + request.name = 'text'; + request.value = value; + + form.appendChild(request); + document.body.appendChild(form); + + form.submit(); + +} + +var round = 0; +var MAX_ROUND = 10; + +var timer = 0; +var select = 0; + +var A = 0; +var B = 1; +var C = 2; +var D = 3; +var CORRECT = 1; +var WRONG = 0; + +var scene = 1; + +var BLOCK_SIZE = 5; +var my_order = 8; +var ranking_order = ["ルフィ", "ゾロ", "ジンベエ", "サンジ", "ロビン", "ウソップ", "フランキー", "ブルック", "ナミ", "チョッパー"] +var scoreing_order = [3000000000,1110000000, 1100000000, 1032000000, 930000000, 500000000, 394000000, 383000000, 366000000, 1000] +var MAX_ORDER = 10; + +var question = new Array(MAX_ROUND); +for(var i = 0; i < MAX_ROUND+1; i ++){ + question[i] = new Question(); +} + +var player = new Player(); + + +var questions = ["「にっこり」の対義語は?", + "もっとも年齢が高いのは?", + "中国語で「勉強」意味は?", + "焼き肉の「テッポウ」はどこの部位?", + "アフリカ大陸でもっとも面積が大きい国は?", + "実在する生き物は?", + "カスタネットの名前の由来となったものは?", + "名前が人物に由来しているのは?", + "ジンベイザメは英語で何シャーク?", + "心臓がない生き物は?"]; + +var answer = [C, A, B, B, C, C, C, C, B, B]; + +var choices = [["がっくり", "げっそり", "むっつり", "しっとり"], + ["ドナルド・トランプ", "ボリス・ジョンソン", "ウラジーミル・プーチン", "アンゲラ・メルケル"], + ["喧嘩っ早い", "無理やり", "細かい", "意地悪な"], + ["食道", "直腸", "こめかみ", "胃袋"], + ["エチオピア", "リビア", "アルジェリア", "ケニア"], + ["キリンコウモリ", "ライオンコウモリ", "ウサギコウモリ", "オオカミコウモリ"], + ["ハサミの刃", "貝の殻", "栗の実", "両手"], + ["そら豆", "えんどう豆", "いんげん豆", "ひよこ豆"], + ["エレファント", "ホエール", "ダイナソー", "メガ"], + ["カニ", "ナマコ", "タコ", "ホタテ"]]; + + +// 送信用 +var form = document.createElement('form'); +var request = document.createElement('input'); diff --git a/flask/testapp/static/javascript/resultScreen.js b/flask/testapp/static/javascript/resultScreen.js new file mode 100644 index 0000000..3e33aed --- /dev/null +++ b/flask/testapp/static/javascript/resultScreen.js @@ -0,0 +1,41 @@ + +/* +function setup(){ + canvasSize(960, 1200); + lineW(3); + loadImg(0, "image/bg.png"); + +}*/ + +function showResult(){ + fill("silver"); + setAlp(50); + fRect(50, 50, 855, 100, "black"); + fText("結果発表 ", 480, 100, 80, "white"); + fText("あなたの順位は...", 230, 200, 50, "black"); + fText(my_order+"位!", 480, 300, 110, "red"); + fRect(45, 370, 865, 700, "white"); + fText("成績上位者", 300, 410, 50, "black"); + fText("スコア", 670, 410, 50, "black"); + for (var i = 0; i < MAX_ORDER; i++){ + if(i+1==1){ + fText((i+1)+"位", 100, 480+60*i, 50, "gold"); + } + else if(i+1==2){ + fText((i+1)+"位", 100, 480+60*i, 50, "silver"); + } + else if(i+1==3){ + fText((i+1)+"位", 100, 480+60*i, 50, "#8c4841"); + } + else{ + fText((i+1)+"位", 100, 480+60*i, 50, "black"); + } + fText(ranking_order[i], 300, 480+60*i, 50, "white"); + fText(scoreing_order[i], 670, 480+60*i, 50, "white"); + } + + if(tapC > 1){ + + } + +} \ No newline at end of file diff --git a/flask/testapp/templates/testapp/index.html b/flask/testapp/templates/testapp/index.html new file mode 100644 index 0000000..dd0b9db --- /dev/null +++ b/flask/testapp/templates/testapp/index.html @@ -0,0 +1,29 @@ + + + +美人投票ゲーム + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/flask/testapp/views.py b/flask/testapp/views.py new file mode 100644 index 0000000..a3985f1 --- /dev/null +++ b/flask/testapp/views.py @@ -0,0 +1,22 @@ +from flask import render_template, request +from testapp import app + + +@app.route("/form", methods=["GET", "POST"]) +def index(): + if request.method == "GET": + return render_template("testapp/index.html") + if request.method == "POST": + print("POSTデータ受け取ったので処理します。") + data = request.form["text"] + print(data) + return render_template("testapp/index.html") + + +# @app.route("/test") +# def index2(): +# my_dict = { +# "insert_something1": "views.pyのinsert_something1部分です。", +# "insert_something2": "views.pyのinsert_something2部分です。", +# } +# return render_template("testapp/index.html", my_dict=my_dict) diff --git a/index.html b/index.html deleted file mode 100644 index f0bd57d..0000000 --- a/index.html +++ /dev/null @@ -1,31 +0,0 @@ - - - -美人投票ゲーム - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resultScreen.js b/resultScreen.js deleted file mode 100644 index 3e33aed..0000000 --- a/resultScreen.js +++ /dev/null @@ -1,41 +0,0 @@ - -/* -function setup(){ - canvasSize(960, 1200); - lineW(3); - loadImg(0, "image/bg.png"); - -}*/ - -function showResult(){ - fill("silver"); - setAlp(50); - fRect(50, 50, 855, 100, "black"); - fText("結果発表 ", 480, 100, 80, "white"); - fText("あなたの順位は...", 230, 200, 50, "black"); - fText(my_order+"位!", 480, 300, 110, "red"); - fRect(45, 370, 865, 700, "white"); - fText("成績上位者", 300, 410, 50, "black"); - fText("スコア", 670, 410, 50, "black"); - for (var i = 0; i < MAX_ORDER; i++){ - if(i+1==1){ - fText((i+1)+"位", 100, 480+60*i, 50, "gold"); - } - else if(i+1==2){ - fText((i+1)+"位", 100, 480+60*i, 50, "silver"); - } - else if(i+1==3){ - fText((i+1)+"位", 100, 480+60*i, 50, "#8c4841"); - } - else{ - fText((i+1)+"位", 100, 480+60*i, 50, "black"); - } - fText(ranking_order[i], 300, 480+60*i, 50, "white"); - fText(scoreing_order[i], 670, 480+60*i, 50, "white"); - } - - if(tapC > 1){ - - } - -} \ No newline at end of file