ユーザ作成に完全対応

This commit is contained in:
2023-07-17 17:23:50 +09:00
parent 402c08b6dd
commit 549eeedbf3
12 changed files with 309 additions and 71 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

+20 -13
View File
@@ -1,6 +1,7 @@
#include "hsp3dish.as" #include "hsp3dish.as"
#include "config.hsp" #include "config.hsp"
; 画面サイズ ; 画面サイズ
#const global DISPLAY_WIDTH 1080 #const global DISPLAY_WIDTH 1080
#const global DISPLAY_HEIGHT 1920 #const global DISPLAY_HEIGHT 1920
@@ -17,6 +18,8 @@
#enum global BUFFER_NIZIKA ; ニジカ #enum global BUFFER_NIZIKA ; ニジカ
#enum global BUFFER_BG ; https://www.pakutaso.com/20190249044post-18819.html #enum global BUFFER_BG ; https://www.pakutaso.com/20190249044post-18819.html
#enum global BUFFER_CHAR ; 文字セット #enum global BUFFER_CHAR ; 文字セット
#enum global BUFFER_NAME_DIALOGUE ; 名前入力欄
#enum global BUFFER_BUTTON_OK ; OK ボタン
; サウンド ; サウンド
#enum global SOUND_MUMUMUMU = 0 ; ムムムム #enum global SOUND_MUMUMUMU = 0 ; ムムムム
@@ -30,21 +33,23 @@
#const global FPS 30 #const global FPS 30
#const global LOOP_INTERVAL 1000 / FPS #const global LOOP_INTERVAL 1000 / FPS
#include "./modules/goatoh.mod.hsp" #include "./modules/goatoh.mod.hsp"
#include "./modules/chat.mod.hsp" #include "./modules/chat.mod.hsp"
#include "./modules/char.mod.hsp" #include "./modules/char.mod.hsp"
#include "./modules/keyboard.mod.hsp" #include "./modules/keyboard.mod.hsp"
#include "./modules/setting.mod.hsp" #include "./modules/setting.mod.hsp"
#include "./modules/name_dialogue.mod.hsp"
#ifdef _DEBUG #ifdef _DEBUG
Screen 0, 540, 960 Screen 0, 540, 960
; デバッグ時は assets ディレクトリを参照する. ; デバッグ時は assets ディレクトリを参照する.
ChDir "assets" ChDir "/users/matud/projects/goatoh_training_android/assets"
#endif ; _DEBUG #endif ; _DEBUG
Font MSGOTHIC, 96 Randomize
ViewCalc VPTYPE_2D, Double (gInfo_winX) / DISPLAY_WIDTH, Double (gInfo_winY) / DISPLAY_HEIGHT ViewCalc VPTYPE_2D, Double (gInfo_winX) / DISPLAY_WIDTH, Double (gInfo_winY) / DISPLAY_HEIGHT
@@ -71,11 +76,19 @@
CelLoad "goatoh-tarso.png", BUFFER_GOATOH_TARSO CelLoad "goatoh-tarso.png", BUFFER_GOATOH_TARSO
CelDiv BUFFER_GOATOH_TARSO, 0, 0, 97, 49 CelDiv BUFFER_GOATOH_TARSO, 0, 0, 97, 49
; 文字
CelLoad "font.png", BUFFER_CHAR CelLoad "font.png", BUFFER_CHAR
CelDiv BUFFER_CHAR, 32, 35, 0, 0 CelDiv BUFFER_CHAR, 32, 35, 0, 0
; 名前入力ダイアログ
CelLoad "name-dialogue.png", BUFFER_NAME_DIALOGUE
; OK ボタン
CelLoad "button-ok.png", BUFFER_BUTTON_OK
CelDiv BUFFER_BUTTON_OK, Null, Null, SIZE_X@MyButton / 2, SIZE_Y@MyButton / 2
; ゴートうインスタンス生成 ; ゴートうインスタンス生成
Goatoh = New@Goatoh (960, 800, DIRECTION_LEFT) Goatoh = New@Goatoh (Rnd (1080), Rnd (1920), Rnd (2) + 1)
; 設定読込み ; 設定読込み
Load@Setting Load@Setting
@@ -90,23 +103,17 @@
GMode GMODE_RGB0 ; アルファあり GMode GMODE_RGB0 ; アルファあり
Show@Keyboard Show@NameDialogue
Pos 100, 100
Text = New@Char ("")
size@Char.Text = 240
Repeat Repeat
ReDraw False ReDraw False
Pos 0, 0 Pos 0, 0
CelPut BUFFER_BG, 0, Double (DISPLAY_HEIGHT) / 533, Double (DISPLAY_HEIGHT) / 533 CelPut BUFFER_BG, 0, Double (DISPLAY_HEIGHT) / 533, Double (DISPLAY_HEIGHT) / 533
Draw@Goatoh Goatoh Draw@Goatoh
Draw@Char
Draw@Keyboard Draw@Keyboard
Draw@NameDialogue
Print GetChar@Keyboard () != False Draw@Char
text@Char.Text = text@Keyboard
ReDraw True ReDraw True
Await LOOP_INTERVAL Await LOOP_INTERVAL
+10 -3
View File
@@ -1,3 +1,6 @@
#ifndef __CHAR__
#define __CHAR__
#module \ #module \
Char Char
@@ -6,6 +9,8 @@ Char
#defcfunc local \ #defcfunc local \
New \ New \
int p_posX,\
int p_posY,\
str p_text str p_text
If insNum <= 0 { If insNum <= 0 {
SDim charDict, 384 SDim charDict, 384
@@ -16,8 +21,8 @@ New \
text.insNum = p_text text.insNum = p_text
posX.insNum = gInfo_cX posX.insNum = p_posX
posY.insNum = gInfo_cY posY.insNum = p_posY
size.insNum = CHAR_WIDTH size.insNum = CHAR_WIDTH
exists.insNum = True exists.insNum = True
@@ -29,7 +34,7 @@ New \
#deffunc local \ #deffunc local \
Destroy \ Destroy \
int p_insId int p_insId
exists.insNum = False exists.p_insId = False
Return Return
@@ -100,3 +105,5 @@ MyStrMid \
#global #global
#endif ; not __CHAR__
+5
View File
@@ -1,3 +1,6 @@
#ifndef __CHAT__
#define __CHAT__
#module \ #module \
Chat Chat
@@ -23,3 +26,5 @@ Send \
#global #global
#endif ; not __CHAT__
+41
View File
@@ -0,0 +1,41 @@
#ifndef __DIALOGUE__
#define __DIALOGUE__
#module \
Dialogue
#const DIALOGUE_WIDTH 840
#const DIALOGUE_HEIGHT 600
#const DIALOGUE_TOP 360
#const DIALOGUE_BOTTOM (DIALOGUE_TOP + DIALOGUE_HEIGHT)
#const DIALOGUE_LEFT ((DISPLAY_WIDTH - DIALOGUE_WIDTH) / 2)
#const DIALOGUE_RIGHT ((DISPLAY_WIDTH + DIALOGUE_WIDTH) / 2)
#deffunc local \
Show
showing = True
Return
#deffunc local \
Hide
showing = False
Return
#deffunc local \
Draw
If showing = False {
Return
}
Pos DIALOGUE_LEFT, DIALOGUE_TOP
CelPut bufferId
Return
#global
#endif ; not __DIALOGUE__
+34 -32
View File
@@ -104,72 +104,74 @@ Eat \
Return Return
#deffunc local \ #deffunc local \
Draw \ Draw
int p_insId Repeat insNum
Pos posX.p_insId - scale.p_insId * 50, posY.p_insId + scale.p_insId * 26 Pos posX.cnt - scale.cnt * 50, posY.cnt + scale.cnt * 26
CelPut BUFFER_GOATOH_LEG, 0, scale.p_insId, scale.p_insId, legArgs.LEG_RF.p_insId CelPut BUFFER_GOATOH_LEG, 0, scale.cnt, scale.cnt, legArgs.LEG_RF.cnt
Pos posX.p_insId + scale.p_insId * 30, posY.p_insId + scale.p_insId * 26 Pos posX.cnt + scale.cnt * 30, posY.cnt + scale.cnt * 26
CelPut BUFFER_GOATOH_LEG, 0, scale.p_insId, scale.p_insId, legArgs.LEG_RH.p_insId CelPut BUFFER_GOATOH_LEG, 0, scale.cnt, scale.cnt, legArgs.LEG_RH.cnt
Pos posX.p_insId + scale.p_insId * 64, posY.p_insId - scale.p_insId * 12 Pos posX.cnt + scale.cnt * 64, posY.cnt - scale.cnt * 12
CelPut BUFFER_GOATOH_TAIL, 0, scale.p_insId, scale.p_insId CelPut BUFFER_GOATOH_TAIL, 0, scale.cnt, scale.cnt
Pos posX.p_insId, posY.p_insId Pos posX.cnt, posY.cnt
CelPut BUFFER_GOATOH_TARSO, 0, scale.p_insId, scale.p_insId CelPut BUFFER_GOATOH_TARSO, 0, scale.cnt, scale.cnt
Pos posX.p_insId - scale.p_insId * 30, posY.p_insId + scale.p_insId * 30 Pos posX.cnt - scale.cnt * 30, posY.cnt + scale.cnt * 30
CelPut BUFFER_GOATOH_LEG, 0, scale.p_insId, scale.p_insId, legArgs.LEG_LF.p_insId CelPut BUFFER_GOATOH_LEG, 0, scale.cnt, scale.cnt, legArgs.LEG_LF.cnt
Pos posX.p_insId + scale.p_insId * 50, posY.p_insId + scale.p_insId * 30 Pos posX.cnt + scale.cnt * 50, posY.cnt + scale.cnt * 30
CelPut BUFFER_GOATOH_LEG, 0, scale.p_insId, scale.p_insId, legArgs.LEG_LH.p_insId CelPut BUFFER_GOATOH_LEG, 0, scale.cnt, scale.cnt, legArgs.LEG_LH.cnt
Pos posX.p_insId - scale.p_insId * 64, posY.p_insId - scale.p_insId * 20 Pos posX.cnt - scale.cnt * 64, posY.cnt - scale.cnt * 20
CelPut BUFFER_GOATOH_HEAD, 0, scale.p_insId, scale.p_insId, neckArg.p_insId CelPut BUFFER_GOATOH_HEAD, 0, scale.cnt, scale.cnt, neckArg.cnt
Pos posX.p_insId - scale.p_insId * 64, posY.p_insId - scale.p_insId * 20 Pos posX.cnt - scale.cnt * 64, posY.cnt - scale.cnt * 20
If openingEyes { If openingEyes {
If openingMouth { If openingMouth {
CelPut BUFFER_GOATOH_FACE_OO, 0, scale.p_insId, scale.p_insId, neckArg.p_insId CelPut BUFFER_GOATOH_FACE_OO, 0, scale.cnt, scale.cnt, neckArg.cnt
} }
Else { Else {
CelPut BUFFER_GOATOH_FACE_OC, 0, scale.p_insId, scale.p_insId, neckArg.p_insId CelPut BUFFER_GOATOH_FACE_OC, 0, scale.cnt, scale.cnt, neckArg.cnt
} }
} }
Else { Else {
If openingMouth { If openingMouth {
CelPut BUFFER_GOATOH_FACE_CO, 0, scale.p_insId, scale.p_insId, neckArg.p_insId CelPut BUFFER_GOATOH_FACE_CO, 0, scale.cnt, scale.cnt, neckArg.cnt
} }
Else { Else {
CelPut BUFFER_GOATOH_FACE_CC, 0, scale.p_insId, scale.p_insId, neckArg.p_insId CelPut BUFFER_GOATOH_FACE_CC, 0, scale.cnt, scale.cnt, neckArg.cnt
} }
} }
Loop
Interval@Goatoh p_insId Interval@Goatoh
Return Return
#deffunc local \ #deffunc local \
Interval \ Interval
int p_insId Repeat insNum
If walking.p_insId { If walking.cnt {
Walk@Goatoh p_insId Walk@Goatoh cnt
If frame.p_insId \ 150 == 30 { If frame.cnt \ 150 == 30 {
MMPlay SOUND_MUMUMUMU MMPlay SOUND_MUMUMUMU
openingMouth = True openingMouth = True
} }
} }
Else: If running.p_insId { Else: If running.cnt {
DoRun@Goatoh p_insId DoRun@Goatoh cnt
} }
If eating.p_insId { If eating.cnt {
Eat@Goatoh p_insId Eat@Goatoh cnt
} }
frame.p_insId++ frame.cnt++
Loop
Return Return
+20 -8
View File
@@ -1,3 +1,9 @@
#include "./modules/char.mod.hsp"
#ifndef __KEYBOARD__
#define __KEYBOARD__
#module \ #module \
Keyboard Keyboard
@@ -14,10 +20,10 @@ Hide
Return Return
#defcfunc local \ #deffunc local \
GetChar GetChar
if showing = False { if showing = False {
Return "" Return
} }
MTList getChar_id MTList getChar_id
@@ -25,17 +31,23 @@ GetChar
If stat = 0 { If stat = 0 {
touching = False touching = False
Return "" Return
} }
If touching { If touching {
Return "" Return
} }
MTInfo getChar_touchInfo, getChar_id.0 MTInfo getChar_touchInfo, getChar_id.0
touching = True
If Length (getChar_touchInfo) < 4 {
Return
}
If getChar_touchInfo.2 < 1920 - 480 { If getChar_touchInfo.2 < 1920 - 480 {
Return "" Return
} }
getChar_charId = (1080 - getChar_touchInfo.1) / 96 * 5 + (getChar_touchInfo.2 - (1920 - 480)) / 96 getChar_charId = (1080 - getChar_touchInfo.1) / 96 * 5 + (getChar_touchInfo.2 - (1920 - 480)) / 96
@@ -45,9 +57,7 @@ GetChar
Poke text, getChar_textLength + cnt, Peek (charDict@Char, getChar_charId * 3 + cnt) Poke text, getChar_textLength + cnt, Peek (charDict@Char, getChar_charId * 3 + cnt)
Loop Loop
touching = True Return
Return ""
#deffunc local \ #deffunc local \
Draw Draw
@@ -67,3 +77,5 @@ Draw
#global #global
#endif ; not __KEYBOARD__
+96
View File
@@ -0,0 +1,96 @@
#ifndef __MY_BUTTON__
#define __MY_BUTTON__
#module \
MyButton
#const SIZE_X 240
#const SIZE_Y 120
#const ZOOM 0.8
#defcfunc local \
New \
int p_posX,\
int p_posY,\
int p_bufferId,\
label p_onClicked
posX.insNum = p_posX
posY.insNum = p_posY
bufferId.insNum = p_bufferId
onClicked.insNum = p_onClicked
touching.insNum = False
exists.insNum = True
insNum++
Return insNum - 1
#deffunc local \
Destroy \
int p_insId
exists.p_insId = False
Return
#deffunc local \
Interval \
int p_insId,\
local l_id,\
local l_touchInfo
MTList l_id
If stat = 0 {
touching.p_insId = False
Return
}
If touching.p_insId {
Return
}
MTInfo l_touchInfo, l_id.0
touching.p_insId = True
If l_touchInfo.1 < posX.p_insId - ZOOM * SIZE_X / 2 {
Return
}
If l_touchInfo.1 >= posX.p_insId + ZOOM * SIZE_X / 2 {
Return
}
If l_touchInfo.2 < posY.p_insId - ZOOM * SIZE_Y / 2 {
Return
}
If l_touchInfo.2 >= posY.p_insId + ZOOM * SIZE_Y / 2 {
Return
}
GoSub onClicked.p_insId
Return
#deffunc local \
Draw
Repeat insNum
If exists.cnt = False {
Continue
}
Pos posX.cnt, posY.cnt
CelPut bufferId.cnt, 0, ZOOM, ZOOM
Loop
Interval
Return
#global
#endif ; not __MY_BUTTON__
+67
View File
@@ -0,0 +1,67 @@
#include "./modules/dialogue.mod.hsp"
#include "./modules/my_button.mod.hsp"
#include "./modules/keyboard.mod.hsp"
#include "./modules/char.mod.hsp"
#include "./modules/user.mod.hsp"
#ifndef __NAME_DIALOGUE__
#define __NAME_DIALOGUE__
#module \
NameDialogue
#const DIALOGUE_TOP DIALOGUE_TOP@Dialogue
#const DIALOGUE_BOTTOM DIALOGUE_BOTTOM@Dialogue
#const DIALOGUE_LEFT DIALOGUE_LEFT@Dialogue
#const DIALOGUE_RIGHT DIALOGUE_RIGHT@Dialogue
#deffunc local \
Show
ButtonOk = New@MyButton (DISPLAY_WIDTH / 2, DIALOGUE_BOTTOM@Dialogue - 132, BUFFER_BUTTON_OK, *Ok)
Char = New@Char (DIALOGUE_LEFT + 168, DIALOGUE_TOP + 272, "")
size@Char.Char = 64
Show@Keyboard
bufferId@Dialogue = BUFFER_NAME_DIALOGUE
Show@Dialogue
Return
#deffunc local \
Hide
Destroy@MyButton ButtonOk
Destroy@Char Char
Hide@Keyboard
Hide@Dialogue
Return
#deffunc local \
Interval
GetChar@Keyboard
text@Char.Char = text@Keyboard
Return
#deffunc local \
Draw
Draw@Dialogue
Draw@MyButton
Interval
Return
*Ok
Hide
Create@User text@Keyboard
Return
#global
#endif ; not __NAME_DIALOGUE__
+2 -1
View File
@@ -6,8 +6,9 @@ User
#deffunc local \ #deffunc local \
Create \ Create \
str p_name,\
local l_data local l_data
HTTPLoad CREATE_URL HTTPLoad CREATE_URL + "?name=" + p_name
HTTPInfo l_data HTTPInfo l_data
id = 0 id = 0