- Timestamp:
- 05/18/08 21:39:24 (6 months ago)
- Location:
- lang/d/koke/trunk
- Files:
-
- 8 modified
-
boot.d (modified) (2 diffs)
-
clickable.d (modified) (3 diffs)
-
config.d (modified) (4 diffs)
-
config.ini (modified) (1 diff)
-
gamecore.d (modified) (13 diffs)
-
map.d (modified) (5 diffs)
-
resource/image/char.bmp (modified) (previous)
-
resource/image/menu.bmp (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
lang/d/koke/trunk/boot.d
r11602 r11928 28 28 const char[] g_title = "hoge"; // タイトルバー 29 29 30 enum BOOTMODE{ 31 NORMAL, 32 SCREENSAVER, 33 } 34 private BOOTMODE g_bootmode = BOOTMODE.NORMAL; 35 bool isScreenSaver() {return g_bootmode == BOOTMODE.SCREENSAVER;} 30 36 31 37 /* Hell_main ********************************************************************/ … … 42 48 int g_width = 640; 43 49 int g_height = 480; 50 g_bootmode = BOOTMODE.NORMAL; 44 51 foreach(int t,string buf;args) 45 52 { 46 if(buf == "/s" || buf == "/S") is_fullscreen = true; // スクリーンセーバとして起動 53 if(buf == "/s" || buf == "/S"){ 54 // スクリーンセーバとして起動 55 is_fullscreen = true; 56 g_bootmode = BOOTMODE.SCREENSAVER; 57 } 47 58 if(buf == "-window") is_fullscreen = false; 48 59 if(buf == "-fullscreen") is_fullscreen = true; -
lang/d/koke/trunk/clickable.d
r11613 r11928 37 37 ECONOMY, // エコノミー 38 38 CHART, // チャート 39 SAVE, // SAVE 40 LOAD, // LOAD 39 41 40 42 STOP, // 停止 … … 49 51 MIN, // 極小 50 52 } 51 // del he ray ni up fen eco crt stp ply ksk dgr52 const int type_width[] = [ 80 , 80 , 80 , 80 , 80 , 80 , 64 , 64 , 32 , 32 , 32 , 32 ];53 const int type_height[] = [ 32 , 32 , 32 , 32 , 32 , 32 , 16 , 16 , 16 , 16 , 16 , 16 ];54 const int type_style[] = [ LRG , LRG , LRG , LRG , LRG , LRG , SML , SML , MIN , MIN , MIN , MIN ];53 // del he ray ni up fen eco crt save load stp ply ksk dgr 54 const int type_width[] = [ 80 , 80 , 80 , 80 , 80 , 80 , 64 , 64 , 64 , 64 , 32 , 32 , 32 , 32 ]; 55 const int type_height[] = [ 32 , 32 , 32 , 32 , 32 , 32 , 16 , 16 , 16 , 16 , 16 , 16 , 16 , 16 ]; 56 const int type_style[] = [ LRG , LRG , LRG , LRG , LRG , LRG , SML , SML , SML , SML , MIN , MIN , MIN , MIN ]; 55 57 56 58 this(TYPE type){ … … 196 198 197 199 string getSelected(){return selected;} 200 void setSelected(string str){selected = str;} 198 201 199 202 void draw(){ -
lang/d/koke/trunk/config.d
r6941 r11928 1 /********************************************************************************/1 /********************************************************************************/ 2 2 /* config.d */ 3 3 /*------------------------------------------------------------------------------*/ … … 28 28 char[][char[]] _data; // データ(キーと値) 29 29 char[] _filepath; // ファイルパス 30 d_time _ft a; // ファイルの最終更新時間(監視用)30 d_time _ftm; // ファイルの最終更新時間(監視用) ftaからftmへ変更 31 31 public: 32 32 this() {} … … 63 63 getTimes(filepath , current_ftc , current_fta , current_ftm); 64 64 65 _ft a = current_fta;65 _ftm = current_ftm; 66 66 } 67 67 char[] get(char[] key) { checkKey(key); return _data[key]; } // 文字列で取得 … … 98 98 getTimes(_filepath , current_ftc , current_fta , current_ftm); 99 99 100 if(current_ft a > _fta) return false;100 if(current_ftm > _ftm) return false; 101 101 return true; 102 102 } -
lang/d/koke/trunk/config.ini
r7148 r11928 31 31 MAP_HEIGHT = 48 32 32 33 34 35 # -------------------------------------------------------------------- 36 # MAP_SAVE_FILE 37 # �@�}�b�v�f�[�^��[�u�����@�C���� 38 MAP_SAVE_FILE = mapdata.txt 39 40 # MAP_LOAD_FILE 41 # �@�}�b�v�f�[�^��[�h�����@�C���� 42 MAP_LOAD_FILE = mapdata.txt 33 43 34 44 -
lang/d/koke/trunk/gamecore.d
r11612 r11928 49 49 ClickablePool economy_switch; // エコノミーのON/OFFスイッチ(右上 50 50 ClickablePool speed_switch; // 速度スイッチ(右上 51 ClickablePool save_switch; // セーブ 52 ClickablePool load_switch; // ロード 51 53 52 54 int cursor_x; // マウス直下の座標x(マップチップ座標系) … … 66 68 int message_timer; // システムメッセージ表示用タイマ 67 69 string message; // システムメッセージ 70 enum MESSAGE_COLOR{ 71 NORMAL, 72 ERROR, 73 } 74 MESSAGE_COLOR message_color; // システムメッセージの色 68 75 69 76 int mray_timer; // 運営レーザー用タイマ … … 71 78 int shake_power; // 画面ゆれ強度 72 79 73 static const int CONFIG_RELOAD_CHECK_INTERVAL = 40 * 5; // コンフィグ再読み込み確認74 static const int MESSAGE_SHOW_INTERVAL = 40 * 3; // 「コンフィグ読み込んだ」表示時間80 static const int CONFIG_RELOAD_CHECK_INTERVAL = 40 * 5; // コンフィグ再読み込み確認 81 static const int MESSAGE_SHOW_INTERVAL = 40 * 3; // システムメッセージ表示時間 75 82 76 83 // 運営レーザー用タイマー数値 … … 84 91 configparser = new ConfigParser(); 85 92 configparser.load(CONFIG_PATH); 93 86 94 message_timer = 0; 87 95 message = ""; 96 message_color = MESSAGE_COLOR.NORMAL; 88 97 89 98 mray_timer = 0; … … 139 148 speed_switch.add("danger" , new Vec3( -32*1 , 16 ,0) 140 149 , ImageButton.TYPE.DANGER); 150 151 // save/load 152 save_switch = new ClickablePool(); 153 save_switch.add("save" , new Vec3( -32*4 , 32 , 0) 154 , ImageButton.TYPE.SAVE); 155 156 load_switch = new ClickablePool(); 157 load_switch.add("load" , new Vec3( -32*2 , 32 , 0) 158 , ImageButton.TYPE.LOAD); 159 141 160 } 142 161 … … 174 193 economy_switch.getMouseClick(); 175 194 speed_switch.getMouseClick(); 195 save_switch.getMouseClick(); 196 load_switch.getMouseClick(); 197 198 // save&load 199 if(load_switch.getSelected() == "load"){ 200 if( map.loadFile( configparser.get("MAP_LOAD_FILE") ) ){ 201 setMessage("MAP LOAD SUCCESS"); 202 }else{ 203 setMessage("** MAP LOAD FAIL **" , MESSAGE_COLOR.ERROR); 204 } 205 load_switch.setSelected(""); 206 } 207 if(save_switch.getSelected() == "save"){ 208 if( map.saveFile( configparser.get("MAP_SAVE_FILE") ) ){ 209 setMessage("MAP SAVE SUCCESS"); 210 }else{ 211 setMessage("** MAP SAVE FAIL **" , MESSAGE_COLOR.ERROR); 212 } 213 save_switch.setSelected(""); 214 } 176 215 177 216 string menucmd = menu.getSelected(); … … 275 314 configparser.update(); 276 315 config_reload = 0; 277 message_timer = MESSAGE_SHOW_INTERVAL; 278 message = "CONFIG RELOAD"; 316 setMessage("CONFIG RELOAD"); 279 317 } 280 318 if(message_timer > 0) message_timer--; … … 400 438 economy_switch.draw(); 401 439 speed_switch.draw(); 440 save_switch.draw(); 441 load_switch.draw(); 402 442 403 443 // チャート … … 406 446 // message 407 447 if(message_timer > 0 && timer % 11 < 10){ 408 Hell_drawFont(message , (getScreenWidth() - 8 * message.length)/ 2 , getScreenHeight() / 2 409 , 1 , 255,128,0); 448 if(message_color == MESSAGE_COLOR.ERROR){ 449 Hell_drawFont(message , (getScreenWidth() - 8 * message.length)/ 2 , getScreenHeight() / 2 450 , 1 , 255,128,0); 451 }else{ 452 Hell_drawFont(message , (getScreenWidth() - 8 * message.length)/ 2 , getScreenHeight() / 2 453 , 1 , 128,192,255); 454 } 410 455 } 411 456 … … 435 480 bool onMouseMap(){ 436 481 if(menu.getMouseOver() == "" && economy_switch.getMouseOver() == "" 437 && chart_switch.getMouseOver() == "" && speed_switch.getMouseOver() == "") return true; 482 && chart_switch.getMouseOver() == "" && speed_switch.getMouseOver() == "" 483 && save_switch.getMouseOver() == "" && load_switch.getMouseOver() == "") return true; 438 484 439 485 return false; … … 449 495 } 450 496 return str; 497 } 498 499 // システムメッセージ表示 500 void setMessage( string msg , MESSAGE_COLOR color = MESSAGE_COLOR.NORMAL){ 501 message_timer = MESSAGE_SHOW_INTERVAL; 502 message = msg; 503 message_color = color; 451 504 } 452 505 } … … 480 533 GameMain gamemain; 481 534 482 static const int LOG_MAX = 160;535 static const int LOG_MAX = 320; 483 536 static const int LOG_VIEW_WIDTH = 4; 484 537 … … 526 579 for(int t=0;t<logs.length - 1;t++){ 527 580 if(logs[t] && logs[t+1]){ 581 if( gamemain.getScreenWidth() + (t+1 - logs.length) * LOG_VIEW_WIDTH < 0) break; 582 528 583 for(int e;e < logs[t].param.length ; e++){ 529 584 if(r[e] == 0 && g[e] == 0 && b[e] == 0) continue; 530 585 531 Hell_drawLine(t * LOG_VIEW_WIDTH , gamemain.getScreenHeight() - 80 - logs[t].param[e] * scale 532 , (t+1) * LOG_VIEW_WIDTH , gamemain.getScreenHeight() - 80 - logs[t+1].param[e] * scale 586 Hell_drawLine(gamemain.getScreenWidth() + (t - logs.length) * LOG_VIEW_WIDTH 587 , gamemain.getScreenHeight() - 80 - logs[t].param[e] * scale 588 , gamemain.getScreenWidth() + (t+1 - logs.length) * LOG_VIEW_WIDTH 589 , gamemain.getScreenHeight() - 80 - logs[t+1].param[e] * scale 533 590 , 2 , r[e] , g[e] , b[e]); 534 591 } -
lang/d/koke/trunk/map.d
r7113 r11928 1 /********************************************************************************/1 /********************************************************************************/ 2 2 /* map.d */ 3 3 /*------------------------------------------------------------------------------*/ … … 36 36 MOVIE = 1, 37 37 FENCE, 38 } 39 const static string name[] = ["NONE" , "MOVIE" , "FENCE"]; 38 WATER, 39 DARK, 40 } 41 const static string name[] = ["NONE" , "MOVIE" , "FENCE" , "WATER" , "DARK" ]; 40 42 41 43 const static int TYPEDRAW_LOOP = 16; … … 110 112 return 4; 111 113 } 114 } 115 116 char toSerializedChar(){ 117 if( type == TYPE.NONE ) return ' '; 118 if( type == TYPE.MOVIE ) return 'W'; 119 if( type == TYPE.FENCE ) return 'F'; 120 if( type == TYPE.WATER ) return 'M'; 121 if( type == TYPE.DARK ) return 'D'; 122 Hell_write("Undefined mapdata serialize to char."); 123 return ' '; 124 } 125 126 bool setSerializedChar( char ch ){ 127 if( ch == ' ' ) return set( TYPE.NONE , 0 ); 128 if( ch == 'W' ) return set( TYPE.MOVIE , 0 ); 129 if( ch == 'F' ) return set( TYPE.FENCE , 0 ); 130 if( ch == 'M' ) return set( TYPE.WATER , 0 ); 131 if( ch == 'D' ) return set( TYPE.DARK , 0 ); 132 Hell_write("Undefine mapdata restore from char"); 133 return false; 134 } 135 136 bool set( TYPE type , double grass ){ 137 this.type = type; 138 this.grass = grass; 139 return true; 112 140 } 113 141 } … … 275 303 } 276 304 305 // ロード 306 bool loadFile( string filename ){ 307 string[] buffer; 308 try{ 309 buffer = std.string.split( cast(string) std.file.read(filename) , "\n" ); 310 }catch(Exception e){ 311 Hell_write(e); 312 return false; 313 } 314 315 for(int y = 0 ; y < buffer.length ; y++ ){ 316 string line = buffer[y]; 317 for(int x = 0 ; x < line.length ; x++ ){ 318 char ch = line[x]; 319 MapChip m = toMap( x , y ); 320 if(m) m.setSerializedChar( ch ); 321 } 322 } 323 return true; 324 } 325 // セーブ 326 bool saveFile( string filename ){ 327 string buffer = ""; 328 for(int y = 0; y < height ; y++ ){ 329 for(int x = 0 ; x <width ; x++ ){ 330 MapChip m = toMap(x,y); 331 buffer ~= m.toSerializedChar(); 332 } 333 buffer ~= "\n"; 334 } 335 336 try{ 337 std.file.write( filename , buffer ); 338 }catch(Exception e){ 339 Hell_write(e); 340 return false; 341 } 342 return true; 343 } 344 345 // マップチップを配置 277 346 bool set(int x,int y,MapChip.TYPE type){ 278 347 if(!inRange(x,y)) return false; 279 348 280 349 MapChip m = toMap(x,y); 281 m.type = type; 282 m.grass = 0; 283 return true; 284 } 285 286 // 芝刈 350 return m.set( type , 0 ); 351 } 352 353 // 芝えねるぎーを配置 287 354 bool setGrass(int x,int y,double grass){ 288 355 if(!inRange(x,y)) return false; … … 293 360 } 294 361 362 // 芝エネルギー値をえる 295 363 double getGrass(int x,int y){ 296 364 if(!inRange(x,y)) return 0;
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)