fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. }
  14. }
Success #stdin #stdout 0.07s 52520KB
stdin
#include <iostream>
#include <string>
#include <vector>

using namespace std;

// --- 画面設定 ---
const int SCREEN_W = 320;
const int SCREEN_H = 240;

// --- ゲームデータ ---
struct GameState {
    string name = "";
    int money = 500000;
    int quality = 1; // 1:MID, 3:ULTRA
    int scene = 0;   // 0:Title, 1:Story, 2:Menu, 3:Setting
};

// --- グラフィックエンジン(OS自作風) ---

// 指定座標に四角(ボタン等)を描画
void drawGUIBox(int x, int y, int w, int h, string label) {
    cout << "[GUI_RECT] Pos:(" << x << "," << y << ") Size:" << w << "x" << h << " Label: " << label << endl;
}

// 配列データからドット絵を描画
void drawDotCar(int x, int y, int quality) {
    if (quality == 3) {
        cout << "[RENDER_ULTRA] GT4画質シェーダー適用:車体反射計算中..." << endl;
    }
    cout << "[RENDER_DOT] 座標(" << x << "," << y << ")に自車を描画" << endl;
}

// --- 各シーンの実装 ---

void runTitle(GameState &gs) {
    cout << "\n=== TITLE SCREEN ===" << endl;
    drawGUIBox(110, 180, 100, 30, "START");
    cout << "名前を入力してスタート: ";
    cin >> gs.name;
    gs.scene = 1; // ストーリーへ
}

void runStory(GameState &gs) {
    cout << "\n=== STORY: 第0話「最速への衝動」 ===" << endl;
    // ULTRAなら高画質演出
    if (gs.quality == 3) cout << "【ULTRAエフェクト】テールランプの残像をブラー描画" << endl;
    
    cout << "S14  [=] >>> 280km/h" << endl;
    cout << "CAMARO [OO] >>> 280km/h" << endl;
    
    cout << "\n[SOUND] ピッ! (ETC確認) -> ブォォォン! (始動)" << endl;
    drawDotCar(50, 150, gs.quality);
    
    cout << "\n1.次へ" << endl;
    int c; cin >> c;
    gs.scene = 2; // メニューへ
}

void runMenu(GameState &gs) {
    cout << "\n=== MAIN MENU (GUI) ===" << endl;
    drawGUIBox(10, 10, 300, 40, "STATUS: " + gs.name + " | " + to_string(gs.money) + " CP");
    drawGUIBox(20, 70, 130, 80, "COURSE: 北陸道");
    drawGUIBox(170, 70, 130, 80, "GARAGE");
    drawGUIBox(20, 170, 280, 40, "SETTING");

    cout << "選択(1:走行 / 2:設定 / 0:終了): ";
    int c; cin >> c;
    if (c == 2) gs.scene = 3;
    else if (c == 0) exit(0);
}

// --- メインループ ---

int main() {
    GameState gs;
    
    while (true) {
        switch (gs.scene) {
            case 0: runTitle(gs); break;
            case 1: runStory(gs); break;
            case 2: runMenu(gs);  break;
            case 3: 
                cout << "\n[SETTING] 画質(1:MID, 3:ULTRA): ";
                cin >> gs.quality;
                gs.scene = 2; 
                break;
        }
    }
    return 0;
}
stdout
Standard output is empty