id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c169600
return nil } return v.pattern }
c169601
p := unsafe.Pointer(v.GObject) return C.toGtkWindow(p) }
c169602
C.toGdkAtom(unsafe.Pointer(uintptr(v))) }
c169603
C.gdk_atom_intern((*C.gchar)(cstr), gbool(onlyIfExists)) return Atom(uintptr(unsafe.Pointer(c))) }
c169604
p := unsafe.Pointer(v.GObject) return C.toGdkDevice(p) }
c169605
p := unsafe.Pointer(v.GObject) return C.toGdkCursor(p) }
c169606
} p := unsafe.Pointer(v.GObject) return C.toGdkDeviceManager(p) }
c169607
p := unsafe.Pointer(v.GObject) return C.toGdkDisplay(p) }
c169608
} p := unsafe.Pointer(v.GObject) return C.toGdkDragContext(p) }
c169609
return nil } return v.GdkEvent }
c169610
v.native().x_root return float64(c) }
c169611
v.native().y_root return float64(c) }
c169612
c.rgba.blue = C.gdouble(b) c.rgba.alpha = C.gdouble(a) }
c169613
p := unsafe.Pointer(v.GObject) return C.toGdkWindow(p) }
c169614
cc.userData = reflect.ValueOf(marshalData[0]) } c := C._g_closure_new() // Associate the GClosure with rf. rf will be looked up in this // map by the closure when the closure runs. closures.Lock() closures.m[c] = cc closures.Unlock() return c, nil }
c169615
} p := unsafe.Pointer(v.GObject) return C.toGtkColorChooser(p) }
c169616
v.GObject == nil { return nil } p := unsafe.Pointer(v.GObject) return C.toGtkColorChooserDialog(p) }
c169617
nil } return (*C.GSource)(v) }
c169618
C.cairo_translate(v.native(), C.double(tx), C.double(ty)) }
c169619
{ C.cairo_scale(v.native(), C.double(sx), C.double(sy)) }
c169620
C.cairo_rotate(v.native(), C.double(angle)) }
c169621
C.cairo_transform(v.native(), matrix.native()) }
c169622
C.cairo_set_matrix(v.native(), matrix.native()) }
c169623
Xy: float64(matrix.xy), Yy: float64(matrix.yy), X0: float64(matrix.x0), Y0: float64(matrix.y0), } }
c169624
{ C.cairo_user_to_device(v.native(), (*C.double)(&x), (*C.double)(&y)) return x, y }
c169625
{ C.cairo_user_to_device_distance(v.native(), (*C.double)(&dx), (*C.double)(&dy)) return dx, dy }
c169626
{ C.cairo_device_to_user(v.native(), (*C.double)(&x), (*C.double)(&y)) return x, y }
c169627
C.cairo_device_to_user_distance(v.native(), (*C.double)(&x), (*C.double)(&y)) return x, y }
c169628
op.ColorM.Scale(1, 1, 1, alpha) screen.DrawImage(s.image, op) screen.DrawImage(s.image, op) }
c169629
return s.resampling.Length() } return s.orig.Length() }
c169630
if d.SampleRate() != context.SampleRate() { r = convert.NewResampling(d, d.Length(), d.SampleRate(), context.SampleRate()) } s := &Stream{ orig: d, resampling: r, toClose: src, } runtime.SetFinalizer(s, (*Stream).Close) return s, nil }
c169631
uiDriver().Input().IsMouseButtonPressed(driver.MouseButton(mouseButton)) }
c169632
ts = append(ts, &touch{ id: id, x: x, y: y, }) } return ts }
c169633
// but the optimized form uses fewer arithmetic operations: // pa := int(b) - int(c) // pa = abs(pa) pc := int(c) pa := int(b) - pc pb := int(a) - pc pc = abs(pa + pb) pa = abs(pa) pb = abs(pb) if pa <= pb && pa <= pc { return a } else if pb <= pc { return b } return c }
c169634
pb = abs(pb) if pa <= pb && pa <= pc { // No-op. } else if pb <= pc { a = b } else { a = c } a += int(cdat[j]) a &= 0xff cdat[j] = uint8(a) c = b } } }
c169635
d := math.Abs(float64(det)) level := 0 for d < 0.25 { level++ d *= 4 } return level }
c169636
:= getWindowThreadProcessId(w) if err != nil { // Ignore errors return } if pid == cpid { // The current process created its own console. Hide this. showWindowAsync(w, windows.SW_HIDE) } }
c169637
(C.GLboolean)(boolToInt(flag))) }
c169638
(C.GLboolean)(boolToInt(flag))) }
c169639
(C.GLint)(level), (C.GLint)(internalformat), (C.GLsizei)(width), (C.GLsizei)(height), (C.GLsizei)(depth), (C.GLint)(border), (C.GLenum)(format), (C.GLenum)(xtype), pixels) }
c169640
i.backend.restorable.QuadVertices(sx0+ox, sy0+oy, sx1+ox, sy1+oy, a, b, c, d, tx, ty, cr, cg, cb, ca) }
c169641
float32(oy) i.backend.restorable.PutVertex(dest, dx, dy, sx+oxf, sy+oyf, bx0+oxf, by0+oyf, bx1+oxf, by1+oyf, cr, cg, cb, ca) }
c169642
math.Float64bits(s)) time.Sleep(cacheUpdateWait) } }
c169643
} for i := 0; i < 2; i++ { if err := addRandomTile(b.tiles, b.size); err != nil { return nil, err } } return b, nil }
c169644
if err := t(); err == taskTerminated { b.tasks = b.tasks[1:] } else if err != nil { return err } return nil } if dir, ok := input.Dir(); ok { if err := b.Move(dir); err != nil { return err } } return nil }
c169645
if t.next.value != 0 { panic("not reach") } if t.current.value == 0 { continue } nextTiles[t] = struct{}{} } b.tiles = nextTiles if err := addRandomTile(b.tiles, b.size); err != nil { return err } return taskTerminated }) return nil }
c169646
(b.size+1)*tileMargin y := x return x, y }
c169647
b.tiles { if t.IsMoving() { animatingTiles[t] = struct{}{} } else { nonAnimatingTiles[t] = struct{}{} } } for t := range nonAnimatingTiles { t.Draw(boardImage) } for t := range animatingTiles { t.Draw(boardImage) } }
c169648
1, uintptr(math.Float32bits(c)), 0, 0) }
c169649
0, 0, 0, 0) return (uint32)(ret) }
c169650
syscall.NewCallback(callback), uintptr(userParam), 0) }
c169651
0, 0, 0, 0) return (uint32)(ret) }
c169652
syscall.Syscall(gpGetGraphicsResetStatus, 0, 0, 0, 0) return (uint32)(ret) }
c169653
1, uintptr(math.Float32bits(width)), 0, 0) }
c169654
1, uintptr(math.Float32bits(token)), 0, 0) }
c169655
1, uintptr(math.Float32bits(size)), 0, 0) }
c169656
:= c.ready c.m.Unlock() return r }
c169657
:= NewPlayer(context, b) if err != nil { // Errors should never happen. panic(fmt.Sprintf("audio: %v at NewPlayerFromBytes", err)) } return p, nil }
c169658
runtime.SetFinalizer(p, nil) return p.p.Close() }
c169659
error { return p.p.Seek(offset) }
c169660
} // Check for EOF, to verify the zlib checksum. n := 0 for i := 0; n == 0 && err == nil; i++ { if i == 100 { return nil, io.ErrNoProgress } n, err = r.Read(d.tmp[:1]) } if err != nil && err != io.EOF { return nil, FormatError(err.Error()) } if n != 0 || d.idatLength != 0 { return nil, FormatError("too much pixel data") } return img, nil }
c169661
for d.stage != dsSeenIEND { if err := d.parseChunk(); err != nil { if err == io.EOF { err = io.ErrUnexpectedEOF } return nil, err } } return d.img, nil }
c169662
cm = d.palette case cbTCA8: cm = color.NRGBAModel case cbG16: cm = color.Gray16Model case cbGA16: cm = color.NRGBA64Model case cbTC16: cm = color.RGBA64Model case cbTCA16: cm = color.NRGBA64Model } return image.Config{ ColorModel: cm, Width: d.width, Height: d.height, }, nil }
c169663
lhst = other.translate } } if c.isInited() { if c.body != nil { rhsb = c.body } if c.translate != nil { rhst = c.translate } } newC := &ColorM{ body: make([]float32, 16), translate: make([]float32, 4), } for i := range lhsb { newC.body[i] = lhsb[i] + rhsb[i] } for i := range lhst { newC.translate[i] = lhst[i] + rhst[i] } return newC }
c169664
v := ebiten.GamepadAxis(c.gamepadID, a.id) if a.positive { return axisThreshold <= v && v <= 1.0 } else { return -1.0 <= v && v <= -axisThreshold } } return false }
c169665
ok := c.axes[b] if ok { if a.positive { return fmt.Sprintf("Axis %d+", a.id) } else { return fmt.Sprintf("Axis %d-", a.id) } } return "" }
c169666
onBeforeUpdateHooks = append(onBeforeUpdateHooks, f) m.Unlock() }
c169667
DebugPrintAt(image, str, 0, 0) return nil }
c169668
if ebiten.IsGamepadButtonPressed(id, b) { return id } } } return -1 }
c169669
return s.decoded.Seek(offset, whence) }
c169670
_, err := d.Read(make([]byte, 65536)); err != nil && err != io.EOF { return nil, 0, 0, err } if _, err := d.Seek(0, io.SeekStart); err != nil { return nil, 0, 0, err } return d, r.Channels(), r.SampleRate(), nil }
c169671
if piece.collides(f, x-1, y, angle) { return x } return x - 1 }
c169672
x, y, angle.RotateRight()) { return angle } return angle.RotateRight() }
c169673
x, y, angle.RotateLeft()) { return angle } return angle.RotateLeft() }
c169674
if f.flushableLine(j) { return true } } return false }
c169675
i++ { if f.blocks[i][j] == BlockTypeNone { return false } } return true }
c169676
< fieldBlockNumX; i++ { f.blocks[i][j2] = f.blocks[i][j2-1] } } for i := 0; i < fieldBlockNumX; i++ { f.blocks[i][0] = BlockTypeNone } return true }
c169677
uNum := -((l1.X1-l1.X2)*(l1.Y1-l2.Y1) - (l1.Y1-l1.Y2)*(l1.X1-l2.X1)) if denom == 0 { return 0, 0, false } t := tNum / denom if t > 1 || t < 0 { return 0, 0, false } u := uNum / denom if u > 1 || u < 0 { return 0, 0, false } x := l1.X1 + t*(l1.X2-l1.X1) y := l1.Y1 + t*(l1.Y2-l1.Y1) return x, y, true }
c169678
point closest to start of ray min := math.Inf(1) minI := -1 for i, p := range points { d2 := (cx-p[0])*(cx-p[0]) + (cy-p[1])*(cy-p[1]) if d2 < min { min = d2 minI = i } } rays = append(rays, line{cx, cy, points[minI][0], points[minI][1]}) } } } // Sort rays based on angle, otherwise light triangles will not come out right sort.Slice(rays, func(i int, j int) bool { return rays[i].angle() < rays[j].angle() }) return rays }
c169679
:= (*reflect.StringHeader)(unsafe.Pointer(&str)) return (*uint8)(unsafe.Pointer(header.Data)) }
c169680
nil) return s.inner.Close() }
c169681
width: width, height: height, } w.init(maxInitLiveCells) return w }
c169682
y := rand.Intn(w.height) w.area[y*w.width+x] = true } }
c169683
case (pop == 2 || pop == 3) && w.area[y*width+x]: // rule 2. Any live cell with two or three live neighbours // lives on to the next generation. next[y*width+x] = true case pop > 3: // rule 3. Any live cell with more than three live neighbours // dies, as if by over-population. next[y*width+x] = false case pop == 3: // rule 4. Any dead cell with exactly three live neighbours // becomes a live cell, as if by reproduction. next[y*width+x] = true } } } w.area = next }
c169684
{ pix[4*i] = 0 pix[4*i+1] = 0 pix[4*i+2] = 0 pix[4*i+3] = 0 } } }
c169685
1/float64(eh)) op.GeoM.Rotate(math.Atan2(y2-y1, x2-x1)) op.GeoM.Translate(x1, y1) op.ColorM.Scale(colorScale(clr)) // Filter must be 'nearest' filter (default). // Linear filtering would make edges blurred. _ = dst.DrawImage(emptyImage, op) }
c169686
must be 'nearest' filter (default). // Linear filtering would make edges blurred. _ = dst.DrawImage(emptyImage, op) }
c169687
if err != nil { return nil, err } return g, nil }
c169688
!= nil { return err } return nil }
c169689
g.board.Draw(g.boardImage) op := &ebiten.DrawImageOptions{} sw, sh := screen.Size() bw, bh := g.boardImage.Size() x := (sw - bw) / 2 y := (sh - bh) / 2 op.GeoM.Translate(float64(x), float64(y)) screen.DrawImage(g.boardImage, op) }
c169690
== 0 && theInputState.prevKeyDurations[key] > 0 theInputState.m.RUnlock() return r }
c169691
s := theInputState.keyDurations[key] theInputState.m.RUnlock() return s }
c169692
theInputState.prevMouseButtonDurations[button] > 0 theInputState.m.RUnlock() return r }
c169693
s := theInputState.mouseButtonDurations[button] theInputState.m.RUnlock() return s }
c169694
if _, ok := theInputState.prevGamepadIDs[id]; !ok { ids = append(ids, id) } } theInputState.m.RUnlock() sort.Ints(ids) return ids }
c169695
theInputState.gamepadIDs[id] theInputState.m.RUnlock() return prev && !current }
c169696
GamepadButtonPressDuration(id, button) == 1 }
c169697
prev = theInputState.prevGamepadButtonDurations[id][button] } current := 0 if _, ok := theInputState.gamepadButtonDurations[id]; ok { current = theInputState.gamepadButtonDurations[id][button] } theInputState.m.RUnlock() return current == 0 && prev > 0 }
c169698
s = theInputState.gamepadButtonDurations[id][button] } theInputState.m.RUnlock() return s }
c169699
ids = append(ids, id) } } theInputState.m.RUnlock() sort.Ints(ids) return ids }