なんとなクエスト IndistinQuest

f:id:Jumpaku:20161002133748p:plain f:id:Jumpaku:20161002133810p:plain f:id:Jumpaku:20161002133821p:plain

"直感とセンスで弱点を見極めろ!!!"

"Find enemy's week point with your feeling!!"

ダウンロード DOWNLOAD
Releases · IndistinQuest/Game · GitHub

紹介 Description

我々は "なんとなクエスト" というゲームを作りました. このゲームはコマンド選択型の戦闘をするゲームです. エネミィの画像と説明文からなんとなく弱点を見極めて, コマンドを選択してください. 倒したエネミィの数と残り時間からスコアが算出されます.

We released a game "なんとなクエスト". This is a command selection battle game. Watch enemy's illustration and reed description. Find enemy's week point with your feeling and select attack command. After battles, your score is calculated using the number of defeated enemies and time.

ゲーム情報

  • タイトル : なんとなクエス
  • 作者 : なんとなクエスト プロジェクト (雄洋, HataG, Namba, Jumpaku, うっひょい)
  • ジャンル : コマンド選択型戦闘
  • プレイ時間 : 10分程度
  • プラットフォーム : Windows
  • リリース : 2016年 10月 01日
  • 言語 : 日本語
  • 利用ライブラリ : Siv3D

Information

  • Title : なんとなクエスト (IndistinQuest)
  • Developers : なんとなクエスト プロジェクト (雄洋, HataG, Namba, Jumpaku, うっひょい)
  • Genle : command selection type battle
  • Playtime : about 10 minutes
  • Platform : Windows
  • Released on : October 1, 2016
  • language : Japanese
  • Library : Siv3D

遊び方 How to play

ゲームを始めるには"なんとなクエスト.exe"を実行して"START"ボタンを押してください. 詳しいルールはゲーム内の"RULE"を見てください.

To start the game, execute "なんとなクエスト.exe", and press "START" button. To see detail rule, press "RULE" button on title scene.

リンク Link

スペクトルバスター Spectrum Buster

f:id:Jumpaku:20160918145312p:plain f:id:Jumpaku:20160918145321p:plain

"恥ずかしさをかなぐり捨てろ!!"

"Don't be shy!!"

経緯 Proccess

サークルの合宿でアイデアソン, ハッカソンをしました. 我々はSiv3DのFFTの機能を利用して簡単なゲームを作成しました.

We held an ideathon and a hackathon. With FFT of Siv3D, we developed a simple game.

紹介 Description

音声をフーリエ変換して, 周波数スペクトルを敵に当てるゲームです. プレイヤは220Hz~880Hzの声を出してください. 左の敵には低音, 右の敵には高音を出しましょう. また, 上の敵には大きな声を出しましょう. 制限時間は30[s]です.

恥ずかしさをかなぐり捨ててできるだけ沢山の敵を倒してください.

Shoot enemies with frequency spectrum of your voice. Input your 220Hz~880Hz voice. To buster left enemy, input low-pitch sound. To buster right enemy, input high-pitch sound. To buster above enemy, input megavolume sound. Time limit is 30[s].

Don't be shy and buster many enemies!!!

ゲーム情報

  • タイトル : スペクトルバスター
  • 作者 : MPC (室蘭プログラミングクラブ) 合宿DE合宿 2016 チーム3
  • ジャンル : FFTシューティング
  • プレイ時間 : 30s程度
  • プラットフォーム : Windows
  • リリース : 2016年 9月 18日
  • 言語 : 日本語
  • 利用ライブラリ : Siv3D

Information

  • Title : Spectrum Buster
  • Developer : MPC (Muroran Programming Club) "合宿DE合宿 2016 Team 3"
  • Genle: FFTSTG
  • Playtime : 30s
  • Platform : Windows
  • Released on : 2016年 9月 18日
  • language : Japanese
  • Library : Siv3D

リンク Links

JavaFX 3 Canvas

Canvasクラス Canvas class

JavaFXCanvasクラスはProcessingやJavaScriptcanvasと同じ様に使う事ができます.

Canvas class of JavaFX can be used the same as Processing or canvas of JavaScript.

GraphicContext

まずCanvasクラスが持っているGraphicContextを取得します.

First, get GraphicContext of Canvas class.

GraphicsContext ctx = canvas.getGraphicsContext2D();

fill, stroke

図形の輪郭を描く時はGraphicContextクラスの"stroke"で始まるメソッドを使用します. また図形の塗り潰す時はGraphicContextクラスの"fill"で始まるメソッドを使用します.

To draw outline of shape, use GraphicContext class's methods starts with "stroke". To paint all over a shape, use GraphicContext class's methods starts with "fill".

ctx.strokeOval(p.getX() - 5, p.getY() - 5, 10, 10)

path

パスを描く時はまずGraphicContextクラスのbeginPathメソッドでパスを開始します. そしてmoveTo, lineTo, quadraticCurveTo, bezierCurveTo, arc, arcTo, appendSVGPath, rect, closePathなどのメソッドでパスを作ります. パスの内側を塗り潰す時はGraphicContextクラスのfillメソッド, パスの輪郭を描く時はstrokeメソッドを使用します.

To generate path, firstly use beginPath method of GraphicContext class. After that, construct path with moveTo, lineTo, quadraticCurveTo, bezierCurveTo, arc, arcTo, appendSVGPath, rect or closePath methods. Finally, if you want to paint all over the region inside the path, use fill method of GraphicContext class. If you want to draw a outline of the path, use stroke method.

ctx.beginPath();
ctx.moveTo(points.get(0).getX(), points.get(0).getY());
points.stream().skip(1).forEach(p -> ctx.lineTo(p.getX(), p.getY()));
ctx.stroke();

clear

キャンバスをクリアする時はGraphicContextクラスのclearRectメソッドを使用します.

To clear the canvas, use clearRect method of GraphicContext.

ctx.clearRect(0, 0, canvas.getWidth(), canvas.getHeight());

サンプル Sample

クリックされた点を直線で繋ぐプログラムです.

The following program draws lines between clicked points.

f:id:Jumpaku:20160729145906p:plain

View.fxml

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.canvas.*?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>

<AnchorPane id="AnchorPane" prefHeight="200" prefWidth="320" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8" fx:controller="canvassample.ViewController">
   <children>
      <Canvas fx:id="canvas" height="200.0" onMouseClicked="#handleClick" width="320.0" />
   </children>
</AnchorPane>

Main.java

package canvassample;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class Main extends Application {
    @Override
    public void start(Stage stage) throws Exception {
        Parent root = FXMLLoader.load(getClass().getResource("View.fxml"));
        stage.setScene(new Scene(root));
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

ViewController.java

package canvassample;

import java.net.URL;
import java.util.LinkedList;
import java.util.List;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.geometry.Point2D;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.input.MouseEvent;

public class ViewController implements Initializable {
    private final List<Point2D> points = new LinkedList<>();
    
    @FXML
    private Canvas canvas;
    
    @FXML
    synchronized private void handleClick(MouseEvent e) {
        points.add(new Point2D(e.getX(), e.getY()));
        GraphicsContext ctx = canvas.getGraphicsContext2D();
        ctx.clearRect(0, 0, canvas.getWidth(), canvas.getHeight());
        
        points.forEach(p -> ctx.strokeOval(p.getX() - 5, p.getY() - 5, 10, 10));
        
        ctx.beginPath();
        ctx.moveTo(points.get(0).getX(), points.get(0).getY());
        points.stream().skip(1).forEach(p -> ctx.lineTo(p.getX(), p.getY()));
        ctx.stroke();
    }
    
    @Override
    public void initialize(URL url, ResourceBundle rb) {
    }    
    
}

恋と友情の常識(No Fight, No Relationship)

"クラスメイトが殺されたの" 私は友人と捜査を始めた. 極端な信条, 矛盾した証言. 真実に辿り着いた時... 交差した思想が1本の線となる.

"One of my class mates was merdered..."
I started investigation with my friend.
Suspects have contradictory statements and strong faiths.
When the truth is out,
their thoughts are integrated.

ゲーム情報

  • タイトル : 恋と友情の常識
  • 読み : こいとゆうじょうのふぁいと
  • 作者 : Jumpaku
  • ジャンル : 説法系推理アドベンチャ
  • プレイ時間 : 30分程度
  • プラットフォーム : Windows
  • リリース : 2016年 7月 24日
  • 言語 : 日本語
  • 開発環境 : WOLF RPGエディター

Detail

  • Title : 恋と友情の常識(No Fight, No Relationship)
  • Pronunciation : Koi to yujo no fight
  • Written by : Jumpaku
  • Genre : Adventure or Mystery with sermons
  • How long : About 30 minutes
  • Platform : Windows
  • Released : July 24, 2016
  • Language : Japanese
  • Tool : Wolf RPG Editor

遊び方 How to play

ゲームを始めるには"Game.exe"を実行して下さい. 詳しい操作方法は"README.txt"を読んで下さい.

Execute Game.exe to start the game. Read README.txt to see detail.

ウディコンにエントリ

このゲームをウディコン2016に提出しました.

Applied to Wodicon

I applied this game to Wodicon 2016.

ヴァージョン Version

  • v1.4 : README.txtの誤字を修正 Fixed a misprint in README.txt.
  • v1.3 : 誤植の修正 Fixed a misprint
  • v1.2 : 致命的な矛盾を修正 Fixed the fatal contradiction.
  • v1.1 : ウディコンに提出する前にサイズを軽量化 Lightening the data size before sending to Wodicon
  • v1.0 : 最初の完成品 Initial product

リンク Links

Visal Studioでコマンドライン引数を使う Use command line argumants on Visual Studio

はじめに Introduction

プログラム実行時にコマンドライン引数を付ける事があります. コマンドライン引数を使うとmain関数に引数を渡す事ができます. また, リダイレクトで標準入出力をキーボードからファイルへと切り換える事ができます.

Visual Studioコマンドライン引数を設定する方法を紹介します.

You can execute a program with some command line arguments. With command line arguments, you can give parameters to the main function and change standard input/output into file from keyboard, in other words, redirection.

This article explains how to set command line arguments on Visual Studio.

問題 What's the problem ?

Visual Studioでプログラムをコンパイルし, 実行する時, 多くの場合実行ボタンや"ctrl"+"F5", "F5"で行うと思います. コマンドライン引数を設定したい場合どこに入力すれば良いのか, 最初私は分かりませんでした.

To compile and execute, usually we use execution button, or press "ctrl"+"F5", or "F5". When you must set command line arguments, where do you set them?

解決策 The Solution

Visual Studioコマンドライン引数を設定する方法は次の通りです.

  1. "プロジェクト"メニュー --> "プロパティ"を開く
  2. "構成プロパティ" --> "デバッグ"を選択
  3. "コマンドライン引数"の項目にプログラムに渡すコマンドライン引数やリダイレクションを追加する

The following is how to set command line arguments on Visual Studio.

  1. Open "Project" --> "Properties"
  2. Select "Configuration Properties" --> "Debug"
  3. Enter command line arguments or redirection you want to add into "Command line arguments".

Visual Studio 2015で確認 Test the above on Visual Studio 2015

標準入力をSampleInput.txtへ, 標準出力をOutputForSampleInputへと切り換えます. SampleInput.txtの内容とmain関数に渡されたコマンドライン引数をOutputForSampleInput.txtに出力します.

Command line arguments to add changes standard input to SampleInput.txt from keyboard and changes standard output to OutputForSampleInput.txt. Program outputs contens of SampleInput.txt and given command line arguments.

追加するコマンドライン引数 Command line arguments to add

What I want to give to main <"SampleInput.txt" >"OutputForSampleInput.txt"

プログラムのソースコード Source code of the program

#include<iostream>
using namespace std;

int main(int argc, char *argv[]){

    cout << "command line arguments : ";
    for (int i = 0; i < argc; ++i) {
        cout << argv[i] << " ";
    }
    cout << endl;

    int a, b;
    cin >> a >> b;
    cout << "sample input : " << a << " " << b;
}

SampleInput.txt

10 89

OutputForSampleInput.txt

command line arguments : C:\YourProjectFolder\x64\Debug\ProgramName.exe What I want to give to main 
sample input : 10 89

OutputForSampleInput.txtを見ると成功していることが確認できます. OutputForSampleInput.txt shows success.

感想 Thoughts

Visual Studio競技プログラミングの問題を解く時などに標準入出力をファイルに切り換えるとデバッグが楽になると思いました.

I thought that changing standard I/O to files makes debugging the source code of programming contest easy.

参考 Bibliography