2017 ソフトウェア設計及び演習用の班Wiki

17::gr07::ヘッダファイル

統合後のヘッダーファイル

Load-module ○担当 遠藤良峻

#ifndef LOAD_WINDOW #define LOAD_WINDOW

#include <gtk/gtk.h>

GtkWidget *labeledButton(char* str);

static void close_window(GtkAction *action, gpointer user_data);

static void load_data_1(GtkAction *action, gpointer user_data);

static void yes_no_window_1(GtkAction *action, gpointer user_data);

static void load_data_2(GtkAction *action, gpointer user_data);

static void yes_no_window_2(GtkAction *action, gpointer user_data);

static void load_data_3(GtkAction *action, gpointer user_data);

static void yes_no_window_3(GtkAction *action, gpointer user_data);

static void open_load_window(GtkAction *action, gpointer user_data);

void signal_connect_load_window(GtkWidget *button);

#endif

field-module ○担当 熊谷龍之裕

/*

field.h

定義と構造体

  • /

#ifndef FIELD_H

#define FIELD_H

#define MAXMAP 2 //mapの数

#define WIDTH 640 //ウインドウの幅

#define HEIGHT 480 //ウインドウの高さ

#define CHARA_SIZE 48 //キャラのサイズ

#define CHARA_SAMPLE "chara1.png" //主人公のキャラの画像ファイル名

#define CHARASPEED 16 //主人公キャラのキー入力で移動するピクセル数

typedef struct { /* アニメーション用パーツ詰め合わせ */

GtkWidget *drawing_area; /* ドローイングエリア */

gint timeout; /* アニメーションのタイムアウト */

GdkPixbuf *s_pixbuf; /* スプライト用ピクスバッファ */

gint s_width; /* スプライト幅 */

gint s_height; /* スプライト高さ */

gint x, y, dx, dy; /* スプライトの座標・ベクトル */

gint s_timeout; /* スプライト自身のタイムアウト */

GdkPixbufAnimationIter *iter; /* アニメーションのイテレータ */

gint map_num; /* 現在のマップの配列の番号 */

} anime_pack;

/*以下関数*/

/*背景関連*/

void map_name_define(char **);

void change_map_ob(GtkWidget *,gpointer); //mapの移動オブジェクト

void set_background(GtkWidget *,gpointer ); //背景(map)を設置

/*基本ウィジェット関連*/

GtkWidget * my_window_new(); //トップレベルウインドウを作る

/*コールバック関数*/

gint my_close_handler(GtkWidget *, gpointer );

static gint cb_delete_event(GtkWidget *, GdkEventExpose *, gpointer );

static gint cb_configure_event(GtkWidget *, GdkEventExpose *, gpointer );

void cb_key_press(GtkWidget *,GdkEventKey *,gpointer );

/*アニメーション関連*/

GtkWidget * my_animation(GtkWidget *, gboolean,gpointer );

static GdkPixbufAnimation * make_anim(anime_pack *);

static gint move_sprite(gpointer );

static gint update_sprite(gpointer );

static void draw_animation(anime_pack *);

static void draw_sprite(anime_pack *);

#endif

gameover-module ○担当 斎藤 渓人

#include <gtk/gtk.h>

#include <stdlib.h>

void cb_quit_button_clicked (GtkWidget *button, gpointer user_data)

{

gtk_main_quit ();

}

void cb_restart_button_clicked (GtkWidget *button, gpointer user_data)

{

gtk_main_quit ();

/* ここは「スタート画面」へ */

}

void

set_background(GtkWidget *window)

{

GdkPixmap *pixmap;

GdkPixbuf *pixbuf;

int width, height;

cairo_t *cr;

/* 背景画像の読み込み */

pixbuf = gdk_pixbuf_new_from_file("black.jpg", NULL);

width = gdk_pixbuf_get_width(pixbuf);

height = gdk_pixbuf_get_height(pixbuf);

/* 必要なサイズのピックスマップを生成 */

pixmap = gdk_pixmap_new(window->window, width, height, -1);

/* 読み込んだ画像をピックスマップに書き込み */

cr = gdk_cairo_create(pixmap);

gdk_cairo_set_source_pixbuf(cr, pixbuf, 0.0, 0.0);

cairo_paint(cr);

cairo_destroy(cr);

/* pixbufを解放 */

g_object_unref(pixbuf);

/* GtkWindowとGtkEventBoxは次の命令がない限り

背景を書き換えることができない */

gtk_widget_set_app_paintable(window, TRUE);

/* 背景をセット */

gdk_window_set_back_pixmap(window->window, pixmap, FALSE);

/* ピックスマップを解放 */

g_object_unref(pixmap);

}

save-module ○担当 佐藤葉介

SaveWindow.h

#ifndef SAVE_WINDOW

#define SAVE_WINDOW

#include <gtk/gtk.h>

GtkWidget *labeledButton(char* str);

void open_save_window(GtkAction *action, gpointer user_data);

#endif

shop-module ○担当 早坂啓太

#include "Status.h"

#include<gtk/gtk.h>

#include <stdio.h>

#include <SDL.h>

#include <SDL_mixer.h>

/*背景設定関数*/

void set_background(GtkWidget *);

/* ボタンがクリックされたときに呼び出される関数

  • /

static void cb_show1_hide0(GtkWidget *button, gpointer user_data);

static void cb_show0_hide1 (GtkWidget *button, gpointer user_data);

static void cb_show0_hide2 (GtkWidget *button, gpointer user_data);

static void cb_show2_hide0 (GtkWidget *button, gpointer user_data);

static void cb_show0_hide3 (GtkWidget *button, gpointer user_data);

static void cb_show3_hide0 (GtkWidget *button, gpointer user_data);

static void cb_show0_hide4 (GtkWidget *button, gpointer user_data);

static void cb_show4_hide0 (GtkWidget *button, gpointer user_data);

static void

cb_button_exit(GtkWidget *button, gpointer user_data);

static void

buy_spotion(GtkWidget *button,gpointer user_data);

static void buy_lpotion(GtkWidget *button,gpointer user_data);

static void buy_xpotion(GtkWidget *button,gpointer user_data);

static void buy_sether(GtkWidget *button,gpointer user_data);

static void buy_lether(GtkWidget *button,gpointer user_data);

static void buy_xether(GtkWidget *button,gpointer user_data);

static void buy_zyaazi(GtkWidget *button,gpointer user_data);

static void buy_tapshoes(GtkWidget *button,gpointer user_data);

static void buy_kattyuu(GtkWidget *button,gpointer user_data);

static void buy_tokei(GtkWidget *button,gpointer user_data);

static void buy_bouon_no_yoroi(GtkWidget *button,gpointer user_data);

static void buy_earring(GtkWidget *button,gpointer user_data);

static void buy_yellowbull(GtkWidget *button,gpointer user_data);

static void buy_doramu_stuck(GtkWidget *button,gpointer user_data);

static void buy_norinoriyaku(GtkWidget *button,gpointer user_data);

static void buy_kyousouyaku(GtkWidget *button,gpointer user_data);

static void buy_syuutyuuyaku(GtkWidget *button,gpointer user_data);

static void buy_metorono_mu(GtkWidget *button,gpointer user_data);

static void buy_kuroame(GtkWidget *button,gpointer user_data);

static void buy_tatikakusan(GtkWidget *button,gpointer user_data);

static void buy_score(GtkWidget *button,gpointer user_data);

static void buy_sikibou(GtkWidget *button,gpointer user_data);

static void buy_groundpiano(GtkWidget *button,gpointer user_data);

static void buy_guiternogen(GtkWidget *button,gpointer user_data);

extern int money;

extern int main_char_hp;

extern int main_char_max_hp;

extern int main_char_max_vp;

extern int main_char_vp;

extern int main_char_attack;

extern int main_char_defence;

extern int main_char_technique;

extern int spotion;

extern int lpotion;

extern int xpotion;

extern int sether;

extern int lether;

extern int xether;

extern int bouon_no_yoroi;

extern int zyaazi;

extern int kattyuu;

extern int tokei;

extern int tapshoes;

extern int earring;

extern int yellowbull;

extern int doramu_stuck;

extern int norinoriyaku;

extern int kyousouyaku;

extern int syuutyuuyaku;

extern int metorono_mu;

extern int kuroame;

extern int tatikakusan;

extern int score;

extern int sikibou;

extern int groundpiano;

extern int guiternogen;

static Mix_Music *se1;

static Mix_Music *se2;

static Mix_Music *se3;

static Mix_Music *se4;

static Mix_Music *se5;

int i=0;

int j=0;

static GtkWidget *window[5];

static GtkWidget *table[5];

static GtkWidget *vbox[5];

static GtkWidget *button1[7];

static GtkWidget *button2[7];

static GtkWidget *button3[7];

static GtkWidget *button4[7];

static GtkWidget *button5[7];

static GtkWidget *layout[5];

static GtkWidget *image[5];

char* init[7]={"回復",

"装備品",

"能力",

"秘密のアイテム",

"exit",

"",

"", };

char* potion[7]={"ポーション小 \n200# HP+10",

"ポーション中 \n500# HP+30",

"ポーション大 \n800# HP+50",

"エーテル小 \n300# VP+10",

"エーテル中 \n600# VP+25",

"エーテル大 \n1000# VP+50",

"アイテム種類選択画面に戻る"

};

char* equip[7]={"ジャージ \n1000# 防御-20",

"タップシューズ \n2000# 技術+30",

"甲冑 \n2500# 防御+45",

"時計 \n3000# 攻撃+20,防御+20",

"防音の鎧 \n4500# 防御+100",

"魔族のイヤリング \n10000# 全能力+50",

"アイテム種類選択画面に戻る"

};

char* strong[7]={"yellowbull \n700# 技術+10",

"ドラム・スティック \n800# 攻撃+20",

"ノリノリ薬 \n700# VP+25",

"狂騒薬 \n2500# 全能力+10",

"ビタミン剤 \n3000# 攻撃+50,HP+20",

"メトロノーム \n4000# VP+40,技術+30",

"アイテム種類選択画面に戻る"

};

char* other[7]={"黒のど飴 \n1000# ???",

"立角酸 \n500# ???",

"SCORE \n900# ???",

"指揮棒 \n3500# ???",

"グランドピアノ \n5000# ???",

"ギターの弦 \n10# ???",

"アイテム種類選択画面に戻る"

};

start-module ○担当 斎藤 渓人

#include <gtk/gtk.h>

#include <stdlib.h>

void cb_start_button_clicked (GtkWidget *button, gpointer user_data)

{

gtk_main_quit ();

/* ここは「スタート画面」へ */

}

void cb_quit_button_clicked (GtkWidget *button, gpointer user_data)

{

gtk_main_quit ();

}

void cb_load_button_clicked (GtkWidget *button, gpointer user_data)

{

gtk_main_quit ();

/* ここは「ロード画面」へ */

}

void

set_background(GtkWidget *window)

{

GdkPixmap *pixmap;

GdkPixbuf *pixbuf;

int width, height;

cairo_t *cr;

/* 背景画像の読み込み */

pixbuf = gdk_pixbuf_new_from_file("umi.jpg", NULL);

width = gdk_pixbuf_get_width(pixbuf);

height = gdk_pixbuf_get_height(pixbuf);

/* 必要なサイズのピックスマップを生成 */

pixmap = gdk_pixmap_new(window->window, width, height, -1);

/* 読み込んだ画像をピックスマップに書き込み */

cr = gdk_cairo_create(pixmap);

gdk_cairo_set_source_pixbuf(cr, pixbuf, 0.0, 0.0);

cairo_paint(cr);

cairo_destroy(cr);

/* pixbufを解放 */

g_object_unref(pixbuf);

/* GtkWindowとGtkEventBoxは次の命令がない限り

背景を書き換えることができない */

gtk_widget_set_app_paintable(window, TRUE);

/* 背景をセット */

gdk_window_set_back_pixmap(window->window, pixmap, FALSE);

/* ピックスマップを解放 */

g_object_unref(pixmap);

}

Status-module  ○担当 佐藤葉介

StatusWindow.h

#ifndef STATUS_WINDOW #define STATUS_WINDOW

#include <gtk/gtk.h>

#define STATUS_WIDTH 600

#define STATUS_HEIGHT 400

void open_status_window(GtkAction *action, gpointer user_data);

void signal_connect_status_window(GtkWidget *button);

void call_status_window();

#endif

Status.h

#ifndef STATUS

#define STATUS

/*

static int money = 5000;

static int main_char_hp = 100;

static int main_char_max_hp = 100; //追加しましたnosuke

static int main_char_max_vp = 100; //追加しましたnosuke

static int main_char_vp = 100;

static int main_char_attack = 100;

static int main_char_defence = 100;

static int main_char_technique = 100;

static int main_char_skill[100] = {0};

static int sub_char1_max_hp = 100; //追加しましたnosuke

static int sub_char1_max_vp = 100; //追加しましたnosuke

static int sub_char1_hp = 100;

static int sub_char1_vp = 100;

static int sub_char1_attack = 100;

static int sub_char1_defence = 100;

static int sub_char1_technique = 100;

static int sub_char1_skill[100] = {0};

static int sub_char2_max_hp = 100; //追加しましたnosuke

static int sub_char2_max_vp = 100; //追加しましたnosuke

static int sub_char2_hp = 100;

static int sub_char2_vp = 100;

static int sub_char2_attack = 100;

static int sub_char2_defence = 100;

static int sub_char2_technique = 100;

static int sub_char2_skill[100] = {0};

static int spotion = 0;

static int lpotion = 0;

static int xpotion = 0;

static int sether = 0;

static int lether = 0;

static int xether = 0;

static int bouon_no_yoroi = 0;

static int zyaazi = 0;

static int kattyuu = 0;

static int tokei = 0;

static int tapshoes = 0;

static int earring = 0;

static int yellowbull = 0;

static int doramu_stuck = 0;

static int norinoriyaku = 0;

static int kyousouyaku = 0;

static int syuutyuuyaku = 0;

static int metorono_mu = 0;

static int tatikakusan = 0;

static int score = 0;

static int sikibou = 0;

static int groundpiano = 0;

static int guiternogen = 0;

  • /

#endif

battle-module ○担当 下瀬川 右京

#include "Status.h"

#include <gtk/gtk.h>

#include <stdlib.h>

#include <stdio.h>

#inlcude <time.h>

#include <SDL.h>

#include <SDL_mixer.h>

static Mix_Music *music;

static Mix_Chunk *se1, *se2, *se3, *se4, *se5, *se6;

static int average_damage_player;

static int damage_player;

static int average_damage_enemy;

static int damage_enemy;

static int crit;

static double counter;

static int counter_i;

static int ability_in;

static int ac;

static int ability_ac;

static void se1_button_clicked(GtkWidget *button, gpointer user_data);

static void se2_button_clicked(GtkWidget *button, gpointer user_data);

static void se3_button_clicked(GtkWidget *button, gpointer user_data);

static void se4_button_clicked(GtkWidget *button, gpointer user_data);

static void se5_button_clicked(GtkWidget *button, gpointer user_data);

static void quit_button_clicked(GtkWidget *button, gpointer user_data);

static void battle_win(void);

static void cb_button_clicked_0 (GtkWidget *button, gpointer user_data);

static void cb_button_clicked_1 (GtkWidget *button, gpointer user_data);

static void cb_button_clicked_2 (GtkWidget *button, gpointer user_data);

static void heal_quantity_10 (GtkWidget *button, gpointer user_data);

static void heal_quantity_20 (GtkWidget *button, gpointer user_data);

static void heal_quantity_25 (GtkWidget *button, gpointer user_data);

static void heal_quantity_30 (GtkWidget *button, gpointer user_data);

static void heal_quantity_40 (GtkWidget *button, gpointer user_data);

static void heal_quantity_50 (GtkWidget *button, gpointer user_data);

static void heal_hp (GtkWidget *button, gpointer user_data);

static void heal_atk (GtkWidget *button, gpointer user_data);

static void heal_def (GtkWidget *button, gpointer user_data);

static void heal_tec (GtkWidget *button, gpointer user_data);

static void heal_all_abi (GtkWidget *button, gpointer user_data);

static void damage_mgn_15 (GtkWidget *button, gpointer user_data);

static void damage_mgn_20 (GtkWidget *button, gpointer user_data);

static void damage_mgn_25 (GtkWidget *button, gpointer user_data);

static void damage_remaining_hp1 (GtkWidget *button, gpointer user_data);

static void damage_remaining_hp2 (GtkWidget *button, gpointer user_data);

static void damage_remaining_hp3 (GtkWidget *button, gpointer user_data);

static void critical_judge1 (GtkWidget *button, gpointer user_data);

static void critical_judge2 (GtkWidget *button, gpointer user_data);

static void critical_judge3 (GtkWidget *button, gpointer user_data);

static void counter_ready (GtkWidget *button, gpointer user_data);

Inevitable_ability (GtkWidget *button, gpointer user_data);

static void Accidental_ability (GtkWidget *button, gpointer user_data);

static void attack_player_skill (GtkWidget *button, gpointer user_data);

static void attack_enemy (GtkWidget *button, gpointer user_data);

static void destroy (GtkWidget *button, gpointer user_data);

int i,j;

GtkWidget *window[3];

GtkWidget *layout[3];

GtkWidget *image1[3];

GtkWidget *image2[3];

GtkWidget *button1[3];

GtkWidget *button2[3];

GtkWidget *button3[3];

GtkWidget *button4[3];

GtkWidget *button10[13];

GtkWidget *button11[13];

GtkWidget *hbox[3];

GtkWidget *tabel[3];

char buffer1[32];

char buffer2[32];

char buffer3[32];

char buffer4[32];

char buffer5[32];

char buffer6[32];

char buffer7[32];

char buffer8[32];

char buffer9[32];

char buffer10[32];

char buffer11[32];

char buffer12[32];

char skill1[32] = "";

char skill2[32] = "";

char skill3[32] = "";

char skill4[32] = "";

char skill5[32] = "";

char skill6[32] = "";

char skill7[32] = "";

char skill8[32] = "";

char skill9[32] = "";

char skill10[32] = "";

char skill11[32] = "";

char skill12[32] = "";

battle-module-2 ○担当 佐藤 葉介

BattleWindow.h

#ifndef BATTLE_WINDOW

#define BATTLE_WINDOW

#define height 640

#define width 480

#define ENEMY_GEO_X 200

#define ENEMY_GEO_Y 50

#define TEXT_MESSAGE_X 50

#define TEXT_MESSAGE_Y 300

#define USER_INTERFACE_X 150

#define USER_INTERFACE_Y 400

#define NEXT_BUTTON_GEO_X 150

#define NEXT_BUTTON_GEO_Y 400

void showBattleWindow(int enemy_num);

#endif

EnemyDifinitions.h

#ifndef ENEMY_DINIFINTIONS

#define ENEMY_DINIFINTIONS

#define PIPO_ENEMY 0

#define PIPO_ENEMY_FILE_LOCATION "pipo-enemy017.png"

#define PIPO_ENEMY_HP 100

#define PIPO_ENEMY_ATTACK 100

#define PIPO_ENEMY_DEFINCE 50

#define BOSS_ENEMY 1

#define BOSS_ENEMY_FILRE_LOCATION "boss.png"

#define BOSS_ENEMY_HP 1000

#define BOSS_ENEMY_ATTACK 200

#define BOSS_ENEMY_DEFINCE 100

#endif


最終更新日:2017/08/04 14:48:27