MCPcopy Create free account
hub / github.com/Siv3D/OpenSiv3D / Main

Function Main

WindowsDesktop/Main.cpp:3–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1# include <Siv3D.hpp> // Siv3D v0.6.16
2
3void Main()
4{
5 // 背景の色を設定する | Set the background color
6 Scene::SetBackground(ColorF{ 0.6, 0.8, 0.7 });
7
8 // 画像ファイルからテクスチャを作成する | Create a texture from an image file
9 const Texture texture{ U"example/windmill.png" };
10
11 // 絵文字からテクスチャを作成する | Create a texture from an emoji
12 const Texture emoji{ U"🦖"_emoji };
13
14 // 太文字のフォントを作成する | Create a bold font with MSDF method
15 const Font font{ FontMethod::MSDF, 48, Typeface::Bold };
16
17 // テキストに含まれる絵文字のためのフォントを作成し、font に追加する | Create a font for emojis in text and add it to font as a fallback
18 const Font emojiFont{ 48, Typeface::ColorEmoji };
19 font.addFallback(emojiFont);
20
21 // ボタンを押した回数 | Number of button presses
22 int32 count = 0;
23
24 // チェックボックスの状態 | Checkbox state
25 bool checked = false;
26
27 // プレイヤーの移動スピード | Player's movement speed
28 double speed = 200.0;
29
30 // プレイヤーの X 座標 | Player's X position
31 double playerPosX = 400;
32
33 // プレイヤーが右を向いているか | Whether player is facing right
34 bool isPlayerFacingRight = true;
35
36 while (System::Update())
37 {
38 // テクスチャを描く | Draw the texture
39 texture.draw(20, 20);
40
41 // テキストを描く | Draw text
42 font(U"Hello, Siv3D!🎮").draw(64, Vec2{ 20, 340 }, ColorF{ 0.2, 0.4, 0.8 });
43
44 // 指定した範囲内にテキストを描く | Draw text within a specified area
45 font(U"Siv3D (シブスリーディー) は、ゲームやアプリを楽しく簡単な C++ コードで開発できるフレームワークです。")
46 .draw(18, Rect{ 20, 430, 480, 200 }, Palette::Black);
47
48 // 長方形を描く | Draw a rectangle
49 Rect{ 540, 20, 80, 80 }.draw();
50
51 // 角丸長方形を描く | Draw a rounded rectangle
52 RoundRect{ 680, 20, 80, 200, 20 }.draw(ColorF{ 0.0, 0.4, 0.6 });
53
54 // 円を描く | Draw a circle
55 Circle{ 580, 180, 40 }.draw(Palette::Seagreen);
56
57 // 矢印を描く | Draw an arrow
58 Line{ 540, 330, 760, 260 }.drawArrow(8, SizeF{ 20, 20 }, ColorF{ 0.4 });
59
60 // 半透明の円を描く | Draw a semi-transparent circle

Callers

nothing calls this directly

Calls 15

SetBackgroundFunction · 0.85
UpdateFunction · 0.85
PosFunction · 0.85
ButtonFunction · 0.85
CheckBoxFunction · 0.85
SliderFunction · 0.85
DeltaTimeFunction · 0.85
MaxFunction · 0.50
MinFunction · 0.50
addFallbackMethod · 0.45
drawMethod · 0.45
pressedMethod · 0.45

Tested by

no test coverage detected