Coder Social home page Coder Social logo

haorenhl007 / sokol-samples Goto Github PK

View Code? Open in Web Editor NEW

This project forked from floooh/sokol-samples

0.0 2.0 0.0 1.42 MB

Sample code for https://github.com/floooh/sokol

License: MIT License

CMake 0.29% C++ 10.06% C 88.62% Python 0.28% Batchfile 0.01% Shell 0.01% Metal 0.01% Objective-C++ 0.21% Objective-C 0.29% Mercury 0.01% HTML 0.13% JavaScript 0.02% CSS 0.07%

sokol-samples's Introduction

sokol-samples

Sample code for https://github.com/floooh/sokol

asm.js/wasm live demos: https://floooh.github.io/sokol-html5/index.html

Work In Progress

Build Status:

Platform Build Status
Windows Build status
OSX/Linux Build Status

Public Service Announcements

  • 12-Apr-2018: New samples have been added to demonstrate the new optional vertex-buffer- and index-buffer-offsets in the sg_draw_state struct. Also the location of fips build-system files have changed, please update fips with a 'git pull' from the fips directory.

  • 27-Mar-2018: The Dear Imgui fips wrapper has recently been moved to a new repository at https://github.com/fips-libs/fips-imgui and updated to the latest ImGui version which required some code changes. If you already had checked out sokol-samples, perform the following steps to udpate:

    1. delete the fips-imgui directory
    2. in the sokol-samples directory, run ./fips fetch

How to build

Make sure that the following tools are in the path. Exact versions shouldn't matter:

> python --version
Python 2.7.10
> cmake --version
cmake version 3.8.2
# make is only needed for building through emscripten
> make --version
GNU Make 3.81
# on OSX (on Windows you just need a recent VS)
> xcodebuild -version
Xcode 9.0

Clone, build and run the native samples:

> mkdir ~/scratch
> cd ~/scratch
> git clone [email protected]:floooh/sokol-samples
> cd sokol-samples
> ./fips build
...
> ./fips list targets
...
> ./fips run triangle-glfw
...

To open the project in Xcode or Visual Studio:

> cd ~/scratch/sokol-samples
> ./fips open

To build for emscripten:

> cd ~/scratch/sokol-samples
> ./fips setup emscripten
[...this will take a while]
> ./fips set config webgl2-emsc-make-release
> ./fips build
...
> ./fips list targets
...
> ./fips run triangle-emsc
...

To build for Metal on OSX:

> cd ~/scratch/sokol-samples
> ./fips set config metal-osx-xcode-debug
> ./fips build
...
> ./fips list targets
...
> ./fips run triangle-metal

To build for Metal on iOS:

> cd ~/scratch/sokol-samples
> ./fips set config metal-ios-xcode-debug
> ./fips set iosteam [YOUR-TEAM-ID]
> ./fips gen
> ./fips open
# Xcode should open now, where you can build and run the iOS code as usual

The [YOUR-TEAM-ID] must be replaced with your Apple Developer Team ID, this is a 10-character string which you can look up on https://developer.apple.com/account/#/membership. If you get build errors about 32-bit targets, exit Xcode, run ./fips clean, ./fips gen and ./fips open again. This is a known but unsolved issue which I need to investigate.

Another known issue: The arraytex-metal sample currently has a weird rendering artefact at least on my iPad Mini4 which looks like Z-fighting.

To build for D3D11 on Windows:

> cd /scratch/sokol-samples
> fips set config d3d11-win64-vstudio-debug
> fips build
...
> fips list targets
...
> fips run triangle-d3d11

To build for Linux:

> cd ~/scratch/sokol-samples
> ./fips set config linux-make-debug
> ./fips build
...
> ./fips list targets
...
> ./fips run triangle-glfw
...

You may need to install some dev-packages required for GLFW on Linux, see here: http://www.glfw.org/docs/latest/compile.html#compile_deps_x11

Type ./fips help for more build system options.

Thanks to:

Enjoy!

sokol-samples's People

Contributors

floooh avatar kevinw avatar

Watchers

 avatar  avatar

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.