This file contains 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
function initCanvas(w, h) { | |
var canvas = document.getElementById("myCanvas"); | |
canvas.width = w; | |
canvas.height = h; | |
canvas.style.width = w + "px"; | |
canvas.style.height = h + "px"; | |
return canvas.getContext('2d'); | |
} | |
function main() { |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>モンテカルロ法</title> | |
<style> | |
canvas { | |
width :200px; |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>CodingChallenge40_WordCounter</title> | |
</head> | |
<body> | |
<h1>Word Counter</h1> |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>pixel sort</title> | |
</head> | |
<body> | |
<h1>Pixel sort</h1> | |
<canvas id="c" width="640" height="320"></canvas> |
This file contains 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
! Molokai theme | |
*xterm*background: #101010 | |
*xterm*foreground: #d0d0d0 | |
*xterm*cursorColor: #d0d0d0 | |
*xterm*color0: #101010 | |
*xterm*color1: #960050 | |
*xterm*color2: #66aa11 | |
*xterm*color3: #c47f2c | |
*xterm*color4: #30309b | |
*xterm*color5: #7e40a5 |
This file contains 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
emcc test_pixel2.c ^ | |
-O2 ^ | |
-Wall -Wextra -pedantic ^ | |
-s USE_SDL=2 ^ | |
-s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS="[""png""]" ^ | |
-s USE_SDL_TTF=2 ^ | |
--preload-file assets ^ | |
-o test_pixel2.html |
This file contains 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
emcc test_pixel.c ^ | |
-O2 ^ | |
-s USE_SDL=2 ^ | |
-s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS="[""png""]" ^ | |
-s USE_SDL_TTF=2 ^ | |
--preload-file assets ^ | |
-o test_pixel.html |
This file contains 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
pixel manipulation: SDL_LockTexture and SDL_MapRGBA sample on Emscripten. | |
# https://gamedev.stackexchange.com/questions/98641/how-do-i-modify-textures-in-sdl-with-direct-pixel-access | |
bellow code dont run. | |
SDL_PixelFormat pixelFormat; | |
pixelFormat.format = format; | |
# rewrite my code. | |
ctx->pixelFormat = SDL_AllocFormat(SDL_PIXELFORMAT_RGBA8888); | |
*p = SDL_MapRGBA(ctx->pixelFormat, 255, 0, 0, 255); |
This file contains 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> | |
#include <iostream> | |
#include <string> | |
#include <random> | |
using namespace std; | |
inline double myrand(double min, double max) | |
{ |
This file contains 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 "stdafx.h" | |
inline void _limit(Vec2& v, double a) | |
{ | |
double b = v.lengthSq(); | |
if (b > a*a) { | |
v /= sqrt((float)b); | |
} | |
v *= a; | |
} | |
inline double heading(Vec2 v) |
OlderNewer