This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include <Siv3D.hpp> // OpenSiv3D v0.4.0 | |
void Main() | |
{ | |
RectF r1(100, 100, 300, 300); | |
RectF r2(50, 50, 50, 50); | |
RectF r3(150, 150, 50, 50); | |
Scene::SetBackground(Palette::Skyblue); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
Array<Array<Vec2>> GetOutlines(const Image& image, function<bool(Color)> judge) | |
{ | |
const Point directions[8] = { { 1, 0 }, { 1, 1 }, { 0, 1 }, { -1, 1 }, { -1, 0 }, { -1, -1 }, { 0, -1 }, { 1, -1 } }; | |
const Rect rect(image.size()); | |
const int width = image.width(); | |
const int height = image.height(); | |
Grid<bool> map(width, height, false); | |
Array<Point> startPositions; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
# include <Siv3D.hpp> | |
class TileMap; | |
class Tile | |
{ | |
friend TileMap; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include <Siv3D.hpp> // OpenSiv3D v0.2.7 | |
class WatchfulEye | |
{ | |
Vec2 m_position; | |
Vec2 m_aimed; | |
Vec2 m_target; | |
double m_degree; | |
double m_timer; | |
double m_size; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pragma once | |
# include <Siv3D.hpp> // OpenSiv3D v0.2.6 | |
class BasicCamera2D | |
{ | |
protected: | |
Vec2 m_center = Window::BaseSize() * 0.5; | |
double m_magnification = 1.0; | |
public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include <Siv3D.hpp> // OpenSiv3D v0.2.5 | |
class Node | |
{ | |
Vec2 m_position; //物理的な座標 | |
Point m_point; //仮想上の座標 | |
double m_height; //高度 | |
double m_radius; //半径 | |
Polygon m_polygon; //形状 | |
Array<Node*> m_near_nodes; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include <Siv3D.hpp> // OpenSiv3D v0.2.5 | |
class Node | |
{ | |
Vec2 m_position; //物理的な座標 | |
Point m_point; //仮想上の座標 | |
public: | |
Node(Point point) | |
: m_point(point) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<Siv3D.hpp> | |
struct Unit | |
{ | |
bool enabled; | |
Point pos; | |
Unit() | |
: enabled(true) | |
, pos(Random(640), Random(480)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Export | |
for (int i = 0; i < 2; i++) | |
{ | |
auto t = tinyCamera.createTransformer(i); | |
for (auto& e : exports) | |
{ | |
if ((ui.drawExportLineEnabled && (ui.selectedItemType == -1 || ui.selectedItemType == e.itemType)) || (ui.selectedUrbanID != -1 && (e.from->id() == ui.selectedUrbanID || e.to->id() == ui.selectedUrbanID))) | |
{ | |
double width = 0.005*e.numItemPerDay; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include <Siv3D.hpp> // OpenSiv3D v0.1.5 | |
struct TinyCamera2D | |
{ | |
TinyCamera2D() = default; | |
void update() | |
{ | |
const Transformer2D t1(Mat3x2::Translate(-sRegion.pos).scale(Window::Size().y / sRegion.size.y), true); | |
//描画領域をマウスホイールで操作する | |
dRegion = dRegion.scaledAt(Cursor::PosF(), 1 + Mouse::Wheel() / 10.0); |