Skip to content

Instantly share code, notes, and snippets.

View hajimehoshi's full-sized avatar
:octocat:
ギットハブ

Hajime Hoshi hajimehoshi

:octocat:
ギットハブ
View GitHub Profile
// SPDX-License-Identifier: 0BSD
package font
import (
"image"
"image/color"
"golang.org/x/image/font"
"golang.org/x/image/math/fixed"
2022/08/23 11:56:34 SO: /usr/lib/wine/../x86_64-linux-gnu/wine/ntdll.dll.so
2022/08/23 11:56:34 SO: /usr/lib/wine/../x86_64-linux-gnu/wine/kernel32.dll.so
2022/08/23 11:56:34 SO: /usr/lib/wine/../x86_64-linux-gnu/wine/kernelbase.dll.so
2022/08/23 11:56:34 SO: /usr/lib/wine/../x86_64-linux-gnu/wine/advapi32.dll.so
2022/08/23 11:56:34 SO: /usr/lib/wine/../x86_64-linux-gnu/wine/winmm.dll.so
2022/08/23 11:56:34 SO: /usr/lib/wine/../x86_64-linux-gnu/wine/user32.dll.so
2022/08/23 11:56:34 SO: /usr/lib/wine/../x86_64-linux-gnu/wine/gdi32.dll.so
2022/08/23 11:56:34 SO: /usr/lib/wine/../x86_64-linux-gnu/wine/version.dll.so
2022/08/23 11:56:34 SO: /usr/lib/wine/../x86_64-linux-gnu/wine/msvcrt.dll.so
2022/08/23 11:56:34 SO: /usr/lib/wine/../x86_64-linux-gnu/wine/ole32.dll.so
----
Update count per frame: 1
Internal image sizes:
2: (16, 16)
3: (16, 16)
4: (4096, 4096)
5: (1024, 1024)
6: (1600, 1200)
Graphics commands:
new-image: result: 1, width: 1024, height: 1024, screen: false
@hajimehoshi
hajimehoshi / benchstat_darwin_vs_go2cpp.txt
Last active November 7, 2021 15:01
Benchmark (Go (GOOS=darwin) vs Go (GOOS=js) vs go2cpp@v0.1.3)
name old time/op new time/op delta
SprintfPadding 221ns ± 2% 748ns ± 1% +238.78% (p=0.008 n=5+5)
SprintfEmpty 18.8ns ± 1% 111.3ns ± 3% +490.87% (p=0.008 n=5+5)
SprintfString 51.4ns ± 0% 246.9ns ± 3% +379.98% (p=0.016 n=4+5)
SprintfTruncateString 94.0ns ± 1% 359.7ns ± 1% +282.49% (p=0.008 n=5+5)
SprintfTruncateBytes 92.0ns ± 2% 362.8ns ± 1% +294.35% (p=0.008 n=5+5)
SprintfSlowParsingPath 62.4ns ± 3% 281.0ns ± 1% +350.13% (p=0.008 n=5+5)
SprintfQuoteString 357ns ± 1% 1304ns ± 2% +264.88% (p=0.008 n=5+5)
SprintfInt 42.3ns ± 1% 228.4ns ± 8% +439.50% (p=0.008 n=5+5)
SprintfIntInt 83.2ns ± 1% 391.2ns ± 0% +370.36% (p=0.008 n=5+5)
diff --git a/renderer/replacepixels.go b/renderer/replacepixels.go
index 2de8786..72c9dd6 100644
--- a/renderer/replacepixels.go
+++ b/renderer/replacepixels.go
@@ -8,11 +8,17 @@ import (
"github.com/hajimehoshi/ebiten/v2"
)
-var screenBuffer *image.RGBA
+var (
@hajimehoshi
hajimehoshi / Dockerfile
Last active January 24, 2021 09:13
Cgo Cross-compile
FROM ubuntu:latest
RUN apt-get update && apt-get install -y \
gcc-10-aarch64-linux-gnu \
gcc-10-multilib \
wget
# Install Go
RUN wget -O go.tar.gz https://dl.google.com/go/go1.15.7.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go.tar.gz && \
package main
import (
"image"
"image/color"
"image/draw"
"image/png"
"os"
"strings"
#!/bin/sh
# Copyright 2012 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# git gofmt pre-commit hook
#
# To use, store as .git/hooks/pre-commit inside your repository and make sure
# it has execute permissions.
#
export PS1='\[\033[40;1;32m\]\u\[\033[2;32m\]@\[\033[0m\]\[\033[40;32m\]\h \[\033[1;36m\]\w\[\033[0m\] \n\\$ '
export ANDROID_HOME=~/Library/Android/sdk
export PATH=/usr/local/opt/ruby/bin:~/go/bin:~/flutter/bin:$ANDROID_HOME/platform-tools:/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/bin:/usr/local/sbin:$PATH
export PATH=~/.cargo/bin:$PATH
export PATH=~/bin:$PATH
function share_history {
history -a
package main
import (
"fmt"
"github.com/hajimehoshi/ebiten"
"github.com/hajimehoshi/ebiten/audio"
"github.com/hajimehoshi/ebiten/audio/vorbis"
raudio "github.com/hajimehoshi/ebiten/examples/resources/audio"
"github.com/hajimehoshi/ebiten/ebitenutil"