Giter Club home page Giter Club logo

go-sdl2-tutorial's Introduction

go-sdl2-tutorial

Adapted from http://lazyfoo.net/tutorials/SDL/

Status

Requirements

Below is some commands that can be used to install the required packages in some Linux distributions. Some older versions of the distributions such as Ubuntu 13.10 may also be used but it may miss an optional package such as libsdl2-ttf-dev on Ubuntu 13.10's case which is available in Ubuntu 14.04.

On Ubuntu 14.04 and above, type:
apt install libsdl2{,-image,-mixer,-ttf,-gfx}-dev

On Fedora 25 and above, type:
yum install SDL2{,_image,_mixer,_ttf,_gfx}-devel

On Arch Linux, type:
pacman -S sdl2{,_image,_mixer,_ttf,_gfx}

On Gentoo, type:
emerge -av libsdl2 sdl2-{image,mixer,ttf,gfx}

On macOS, install SDL2 via Homebrew like so:
brew install sdl2{,_image,_mixer,_ttf,_gfx} pkg-config

On macOS, if you are using the nix package manager, adapt the provided shell.nix to your setup, then type:
nix-shell
You can also setup direnv so that the provided .envrc
can invoke nix-shell for you as soon as you navigate to the project directory

On Windows,

  1. Install mingw-w64 from Mingw-builds
    • Version: latest (at time of writing 6.3.0)
    • Architecture: x86_64
    • Threads: win32
    • Exception: seh
    • Build revision: 1
    • Destination Folder: Select a folder that your Windows user owns
  2. Install SDL2 http://libsdl.org/download-2.0.php
    • Extract the SDL2 folder from the archive using a tool like 7zip
    • Inside the folder, copy the i686-w64-mingw32 and/or x86_64-w64-mingw32 depending on the architecture you chose into your mingw-w64 folder e.g. C:\Program Files\mingw-w64\x86_64-6.3.0-win32-seh-rt_v5-rev1\mingw64
  3. Setup Path environment variable
    • Put your mingw-w64 binaries location into your system Path environment variable. e.g. C:\Program Files\mingw-w64\x86_64-6.3.0-win32-seh-rt_v5-rev1\mingw64\bin and C:\Program Files\mingw-w64\x86_64-6.3.0-win32-seh-rt_v5-rev1\mingw64\x86_64-w64-mingw32\bin
  4. Open up a terminal such as Git Bash and run go get -v github.com/veandco/go-sdl2/sdl.
  5. (Optional) You can repeat Step 2 for SDL_image, SDL_mixer, SDL_ttf
    • NOTE: pre-build the libraries for faster compilation by running go install github.com/veandco/go-sdl2/{sdl,img,mix,ttf}
  • Or you can install SDL2 via Msys2 like so: pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2{,_image,_mixer,_ttf,_gfx}

Build

You can build individual binaries for each example, like so:
go build ./cmd/helloSDL

go-sdl2-tutorial's People

Contributors

abhirag 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.