Giter Club home page Giter Club logo

cp's Introduction

Stephen here! I'm building Mach engine so that anyone can create games, visualizations, and desktop/mobile apps in Zig. The goal is to be competitive in spirit with Godot/Unity/Unreal, but more composable, data-driven & tooling oriented.

I also work at a startup called Sourcegraph building developer tools for the last ~8 years. FOSS is in my roots, though, and I dream of creating games and being 100% beholden to individuals. :)

Besides living two lives (full-time startup job & working on Mach ~40h/week), I care for a small army of cats.

Links

cp's People

Contributors

slimsag avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

trichner

cp's Issues

space.DebugDraw causes sigsegv

Still investigating cause of this, here's test code using a minimal implementation of SpaceDebugDrawOptions.

package main

import (
    cp "gopkg.in/slimsag/cp.v1"
)

func main() {
    space := cp.SpaceNew()

    body := cp.BodyNew(10, cp.MomentForCircle(1, 0, 32, cp.V(0, 0)))
    space.AddBody(body)
    space.AddShape(body.CircleShapeNew(32, cp.V(0, 0)))

    debugDraw := &cp.SpaceDebugDrawOptions{
        DrawCircle: func(pos cp.Vect, angle, radius float64,
            outlineColor, fillColor cp.SpaceDebugColor, data interface{}) {
        },
        DrawSegment: func(a, b cp.Vect, color cp.SpaceDebugColor,
            data interface{}) {
        },
        DrawFatSegment: func(a, b cp.Vect, radius float64,
            outlineColor, fillColor cp.SpaceDebugColor, data interface{}) {
        },
        DrawPolygon: func(verts []cp.Vect, radius float64,
            outlineColor, fillColor cp.SpaceDebugColor, data interface{}) {
        },
        DrawDot: func(size float64, pos cp.Vect,
            color cp.SpaceDebugColor, data interface{}) {
        },
        ColorForShape: func(shape *cp.Shape, data interface{}) cp.SpaceDebugColor {
            return cp.SpaceDebugColor{}
        },
        Flags:               cp.SPACE_DEBUG_DRAW_SHAPES,
        ShapeOutlineColor:   cp.SpaceDebugColor{},
        ConstraintColor:     cp.SpaceDebugColor{},
        CollisionPointColor: cp.SpaceDebugColor{},
        Data:                struct{}{},
    }

    space.DebugDraw(debugDraw)
}

Which results in the following crash

SIGSEGV: segmentation violation                                                           
PC=0x7f7578                                                                               
signal arrived during cgo execution                                                       

runtime.cgocall(0x410c40, 0x7fa005321ed8)                                                 
        /usr/local/go/src/pkg/runtime/cgocall.c:149 +0x11b fp=0x7fa005321ec0              
gopkg.in/slimsag/cp%2ev1._Cfunc_cpSpaceDebugDraw(0x1245290, 0xc210042000)                 
        gopkg.in/slimsag/cp.v1/_obj/_cgo_defun.c:2510 +0x31 fp=0x7fa005321ed8             
gopkg.in/slimsag/cp%2ev1.(*Space).DebugDraw(0xc210036030, 0xc210041000)                   
        /home/dave/gocode/src/gopkg.in/slimsag/cp.v1/space.go:662 +0x117 fp=0x7fa005321ef8
main.main()                                                                               
        /tmp/crash/crash.go:40 +0x1f6 fp=0x7fa005321f48                   
runtime.main()                                                                            
        /usr/local/go/src/pkg/runtime/proc.c:220 +0x11f fp=0x7fa005321fa0                 
runtime.goexit()                                                                          
        /usr/local/go/src/pkg/runtime/proc.c:1394 fp=0x7fa005321fa8                       

goroutine 3 [syscall]:                                                                    
runtime.goexit()                                                                          
        /usr/local/go/src/pkg/runtime/proc.c:1394                                         

rax     0x0                                                                               
rbx     0xc210042000                                                                      
rcx     0x0                                                                               
rdx     0x5                                                                               
rdi     0x1245d00                                                                         
rsi     0xc210000008                                                                      
rbp     0x7fff8b917230                                                                    
rsp     0x7fff8b9171a8                                                                    
r8      0xc210001120                                                                      
r9      0x7fa005321e70                                                                    
r10     0x0                                                                               
r11     0x0                                                                               
r12     0x1245d00                                                                         
r13     0xc210000008                                                                      
r14     0x1245be0                                                                         
r15     0x0                                                                               
rip     0x7f7578                                                                          
rflags  0x10246                                                                           
cs      0x33                                                                              
fs      0x0                                                                               
gs      0x0                                                                               
exit status 2                                                                             

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.