Skip to content

Instantly share code, notes, and snippets.

# include <Siv3D.hpp> // OpenSiv3D v0.6.6
double safeDistance = 5.0;
double minDelta = 0.1;
struct Node;
struct Shape
{
bool isSelected = false;
@sknjpn
sknjpn / main.cpp
Created August 21, 2022 03:24
sort segmentation fault
#include <iostream>
#include <vector>
#include <algorithm>
// gcc version 11.2.0 (Ubuntu 11.2.0-19ubuntu1)
int main()
{
const std::vector<int> v = { 1, 4, 2, 5, 5, 2, 3, 5, 2, 3, 4, 6, 3, 2, 5, 1, 2, 3, 4, 5, 6, 5, 6 };
std::vector<const int*> vp(v.size());
using System.Linq;
using System.Collections.Generic;
using UnityEngine;
using System;
public class FlagsManager : MonoBehaviour
{
[SerializeField] int FieldSizeX = 50;
[SerializeField] int FieldSizeZ = 60;
[SerializeField] float TileSize = 2.0f;
using System.Linq;
using System.Collections.Generic;
using UnityEngine;
using System;
public class FlagsManager : MonoBehaviour
{
[SerializeField] int FieldSizeX = 50;
[SerializeField] int FieldSizeZ = 60;
[SerializeField] float TileSize = 2.0f;
class Ball
{
bool enabled = false;
Vec2 position;
}
Ball balls[100];
void update()
{
# update
sudo apt update
sudo apt upgrade -y
# install packages
sudo apt install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev unzip libgl-dev libturbojpeg-dev libgl-dev libglu-dev libopenal-dev libogg-dev libvorbis-dev
# download
cd ~
while (g_client.available())
{
// 全体の長さ
uint64 size = 0;
if (g_client.lookahead<uint64>(size) && g_client.available() >= size)
{
g_client.skip(size);
Deserializer<MemoryWriter> reader;
@sknjpn
sknjpn / Tsukurobo_Arm
Last active September 13, 2019 14:16
#include "OpenSivSerial.hpp"
struct Arm
{
double l1 = 150.0;
double l2 = 100.0;
Vec2 pos = Vec2(200.0, 200.0);
Vec2 delta = Vec2(10.0, 0.0);
void draw(double a1, double a2)
@sknjpn
sknjpn / gist:21ffa1d4c73865fc55488e9aa0cd1265
Created September 8, 2019 05:29
Geometry2D::Subtractのテスト
# 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);
@sknjpn
sknjpn / OutlineDetector.h
Last active September 23, 2019 07:06
OutlineDetector
#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;