疑問に思うことがあれば、スレを立てずに、まずはココで質問。
スレッドを立てる前にはローカルルールを読みましょう。
http://echo.2ch.net/gamedev/
※ >>980 を踏んだ人は次スレ立てをお願いします。
【アップローダ・避難所・Wiki】
ゲーム製作技術板公式Wiki
http://wiki.game-develop.com/
ゲーム製作技術板公式アップローダ
http://gmdev.xrea.jp/
gamdev.orgが落ちるたびにあげてみるスレ
http://hibari.2ch.net/test/read.cgi/gamedev/1107022166
※前スレ
【初心者】スレを立てる前にココで質問を【Part27】
http://echo.2ch.net/test/read.cgi/gamedev/1419935788/
探検
【初心者】スレを立てる前にココで質問を【Part28】©2ch.net
■ このスレッドは過去ログ倉庫に格納されています
2016/05/29(日) 10:15:36.62ID:jiO6jmYG
2016/05/29(日) 10:16:04.07ID:jiO6jmYG
リンクがかなり死んでるようだが、代わりがわからんのでそのまま
2016/05/30(月) 01:31:43.57ID:wtPpkfk+
おつかれさんですよ
4名前は開発中のものです。
2016/05/31(火) 21:49:13.27ID:5XqNUbsR 前スレの992ありがとう。
何故か途中で切れてた。
String[] elementList = new String[]{"A", "B", "C", "D", "E", "F", "G", "H"};
int displaySize = 3; // 画面に表示するアイテム数
int currentChoice = 0;// 今選択中の要素番号インデックス
int start = 0; // 表示要素の開始番号
// 表示はこんな感じ
public void paintComponent(Graphics g) {
for (int i = start; i < start + displaySize; i++) {
g.drawString(elementList[i], 10, 10 * (i - start + 1));
}
何故か途中で切れてた。
String[] elementList = new String[]{"A", "B", "C", "D", "E", "F", "G", "H"};
int displaySize = 3; // 画面に表示するアイテム数
int currentChoice = 0;// 今選択中の要素番号インデックス
int start = 0; // 表示要素の開始番号
// 表示はこんな感じ
public void paintComponent(Graphics g) {
for (int i = start; i < start + displaySize; i++) {
g.drawString(elementList[i], 10, 10 * (i - start + 1));
}
5名前は開発中のものです。
2016/05/31(火) 21:49:47.47ID:5XqNUbsR 続き
public void mousePressed(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) { // 左クリックされた時
currentChoice--;
if (currentChoice < start) { // when choice gets below the starting index
start = currentChoice;
if (currentChoice < 0) { // 一番上に来たら初期化
currentChoice = 0;
start = 0;
}
}
} else if (e.getButton() == MouseEvent.BUTTON3) { // 右クリックされた時
System.out.println("DOWN");
currentChoice++;
if (currentChoice > displaySize - 1) {
System.out.println(start + 1 + displaySize );
if (start + displaySize < elementList.length) {
start++;
}
if (currentChoice > elementList.length - 1) { // 一番下に来た
currentChoice = elementList.length - 1;
}
}
}
}
public void mousePressed(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) { // 左クリックされた時
currentChoice--;
if (currentChoice < start) { // when choice gets below the starting index
start = currentChoice;
if (currentChoice < 0) { // 一番上に来たら初期化
currentChoice = 0;
start = 0;
}
}
} else if (e.getButton() == MouseEvent.BUTTON3) { // 右クリックされた時
System.out.println("DOWN");
currentChoice++;
if (currentChoice > displaySize - 1) {
System.out.println(start + 1 + displaySize );
if (start + displaySize < elementList.length) {
start++;
}
if (currentChoice > elementList.length - 1) { // 一番下に来た
currentChoice = elementList.length - 1;
}
}
}
}
6992
2016/05/31(火) 22:01:02.02ID:b8P60GFh DrawStringまで行ってるなら、縦書きフォント(@MS ゴシックとか)を指定して、
g.Rotate(90度 = 90 * π/180)すればいけそうな気がする?
g.Rotate(90度 = 90 * π/180)すればいけそうな気がする?
7名前は開発中のものです。
2016/05/31(火) 22:10:54.41ID:5XqNUbsR ごめん。縦書きっていうのはドラクエとかで
ーーーーーー
ルーラの杖 |
➡薬草 |
しもふり肉 |
あああああ |
いいいいい |
ーーーーーー
と表示させたいんだ。
ーーーーーー
ルーラの杖 |
➡薬草 |
しもふり肉 |
あああああ |
いいいいい |
ーーーーーー
と表示させたいんだ。
2016/05/31(火) 22:25:16.61ID:b8P60GFh
それは普通の出し方じゃないかw
4のソースを見た感じでは、もうできてるっぽい?
>g.drawString(elementList[i], 10, 10 * (i - start + 1));
ここでY座標を加算しているから、縦に並べられてるはずだな
4のソースを見た感じでは、もうできてるっぽい?
>g.drawString(elementList[i], 10, 10 * (i - start + 1));
ここでY座標を加算しているから、縦に並べられてるはずだな
2016/05/31(火) 22:42:18.70ID:b8P60GFh
どうでもいいことだけど、
> if (currentChoice > displaySize - 1) {
は、
> if (currentChoice > start + displaySize - 1) {
じゃないか?(勘なので間違ってるかもだが)
> if (currentChoice > displaySize - 1) {
は、
> if (currentChoice > start + displaySize - 1) {
じゃないか?(勘なので間違ってるかもだが)
2016/05/31(火) 22:51:27.28ID:syvcyfYr
テキトーなUIライブラリ使えばよくね?
■ このスレッドは過去ログ倉庫に格納されています
ニュース
- 渡邊渚「性を売ってるくせに」批判に反論 幻滅「これが日本の現状だよなー」「『渾身の下着!』というような意味でやってない」★3 [Ailuropoda melanoleuca★]
- 【鮭】20代女性の車のドアノブに体液、不同意わいせつ未遂の容疑で広島市安佐北区の30歳無職男を逮捕 [nita★]
- 【生成ポルノで初】AI生成の児童ポルノ画像の所持疑いで元教諭を初摘発… [BFU★]
- 鈴木農相、地元JAから借入金 おこめ券巡り利害誘導との批判も★2 [安倍聖帝★]
- トランプ米大統領、「台湾保証実行法案」に署名 法案提出議員「支配しようとする中国に我々が断固として立ち向かう」 ★3 [お断り★]
- 米国、ホワイトカラーよりブルーカラーが重視される社会になってしまう、AIの影響で25年大卒者は就職難に直面 ★2 [お断り★]
- 【悲報】Dell、今月中に20%値上げ。Lenovo、来月1月から20%値上げ。なんで君らブラックフライデーで買わなかったの? [838847604]
- 朝イチに立てるリコリコスレ
- 【画像】今どきのJCって大人っぽい下着つけてるんだね
- 【高市悲報】プリキュア「いま私たちは環境問題に関心があるの」 プリオタ「ギェェェェェ思想が強すぎる!!」大炎上🔥 [762037879]
- 独身のおじさんってなんで変なのが多いの?
- 沖縄の在日米軍パトロール、街の治安を乱す輩を一年間で100人逮捕していた [329329848]
