Skip to content

Instantly share code, notes, and snippets.

View falrnd's full-sized avatar

Hozumi Hiroaki falrnd

  • Xbit, Inc.
  • Japan
  • 13:04 (UTC +09:00)
  • X @fal_rnd
View GitHub Profile
@falrnd
falrnd / main.rs
Last active July 19, 2023 03:10
techblog serde flatten + with&remote + rename
use std::ops::{Range, RangeInclusive};
use serde::{Deserialize, Serialize};
// シンプルな(de)serialize
#[derive(Serialize, Deserialize, Debug)]
struct SampleSimple {
xx_start: i32,
xx_end: i32,
@falrnd
falrnd / Main.cpp
Last active December 28, 2021 17:05
BGMaker
# include <Siv3D.hpp> // OpenSiv3D v0.6.3
namespace KeyConfig {
constexpr auto Misc = KeyShift;
constexpr auto NoShow = KeyQ;
}
class MakerRect {
private:
inline static const Array<String> GradOptions
@falrnd
falrnd / Main.cpp
Last active December 18, 2021 11:28
ichi-raven さんの "OpenSiv3Dのサンプルにあるシューティングゲームを改造して弾幕を出してみる(初心者向け)" のコードを勝手に弄る(趣味)(非初心者向け)
# include <Siv3D.hpp>
// Siv3D v0.6.3
// https://qiita.com/ichi-raven/items/61b3cf607deafdba567e
// 画面サイズは(800, 600)とする
constexpr Rect SceneRect{ 800, 600 };
// 敵の位置を作成する関数
[[nodiscard]]
@falrnd
falrnd / SolveSudokuMain.kt
Created July 4, 2020 08:37
技育祭 Day1 Goライブコーディングから触発されたもの
//ExperimentalStdlibApi
fun <T> MutableList<T>.MYremoveLast() = this.removeAt(this.lastIndex)
fun solveSudoku(field:Array<IntArray>):Array<IntArray> {
val row = Array(9) {BooleanArray(10) {false}}
val col = Array(9) {BooleanArray(10) {false}}
val box = Array(3) {Array(3) {BooleanArray(10) {false}}}
fun set(i:Int,j:Int,v:Int,bool:Boolean) {
row[i][v] = bool
#pragma once
#include <Siv3D.hpp>
// https://siv3d.github.io/ja-jp/sample/visual/#2d
class LightBloom2D
{
protected:
Size sceneSize;
RenderTexture gaussianA1, gaussianB1;
RenderTexture gaussianA4, gaussianB4;
//based on https://siv3d.github.io/ja-jp/reference/2d-particle/
# include <Siv3D.hpp>
const String siv3d_kun_path = U"example/siv3d-kun.png";
Polygon CreateSiv3D_kunPolygon()
{
return Image(siv3d_kun_path)
.alphaToPolygonCentered().simplified(1);
}
//https://gist.github.com/falrnd/abc36f56989dc7750bc66e01aae60525
//v1.0.2(とりあえず完成)
#include <iostream>
#include <string>
#include <thread>
#include <chrono>
#include <random>
using std::cin;
@falrnd
falrnd / Main_Client.cpp
Created June 15, 2019 08:39
OpenSiv3D v0.4.0b TCPServer & TCPClient Sample
# include <Siv3D.hpp>
void Main() {
Window::SetStyle(WindowStyle::Sizable);
Scene::Resize(480, 360);
Window::Resize(480, 360);
double a = 127;
double b = 0;
double c = 0;
# pragma once
# include <Siv3D.hpp> //v0.3.3
struct Drag {
using position_type = Vec2;
position_type begin;
void update() {
if (MouseL.down()) {
# include <Siv3D.hpp> // OpenSiv3D v0.3.1
void DrawBiscuit(const Circle& c, bool drawShadow) {
c.drawShadow({0, 2}, 12, 2 + drawShadow * 2)
.draw(Color(250, 180, 100))
.drawFrame(1, 1, Color(240, 140, 80));
Circle(c.center, 1.5).draw(ColorF(0.0, 0.3));
for (auto i : step(6)) {