Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A V SDL2 Wrapper

License

NotificationsYou must be signed in to change notification settings

kjlaw89/vsdl

Repository files navigation

VSDL is a work-in-progress V wrapper for the C-basedSDL library. The aim of this library is to provide a thorough implementation of SDL2 in V. The implementation is faithful to the original API but takes some liberties to provide a native "V" feel.

'Image' Example

Features

  • gfx
    • window management
    • renderer
    • texture
    • surface
    • rect
    • gl hook
    • vulkan hook (untested)
    • pixel formats
  • events
    • basic event handling
    • subscribed events
  • input
    • keyboard
    • mouse
  • controller
    • joysticks
    • game controllers
  • sensors
  • haptics
  • audio
  • ttf
  • mixer
  • image
    • load
    • file type
  • network
  • concurrency/threading
  • RWops

Example

modulemainimportvsdlimportvsdl.eventsimportvsdl.gfxfnmain() {mutwindow:= gfx.create_window("Simple VSDL Window",-1,-1,640,480, .shown)?surface:= window.get_surface()?surface.fill(r:255, g:255, b:255)defer {surface.free()window.destroy()vsdl.quit()}window.update()events.loop()}

See the examples folder for more examples. Run any.v files withv run [file].

Requirements

The SDL2 headers come pre-included with this repo. To run the only thing needed are the runtime binaries.

OnUbuntu 14.04 and above, run:

apt install libsdl2{,-image,-mixer,-ttf}-dev zlib1g-dev libfreetype6-dev

OnMacOS install SDL2 via Homebrew:

brew install sdl2{,-image,-mixer,-ttf}

OnWindows,

  1. Download the runtime binaries from SDL2
  1. Extract the binaries to the folder where your executable resides

Notes about dependencies

This repo comes with a copy of the headers for the version of SDL2 that it was developed against (2.0.12), but does not ship with the runtime libraries. It isnot necessary to get the Image, Mixer or TTF library runtimes if you do not plan to use them in your application.

By default VSDL only initializes the subsystems that are imported. For example, importing justvsdl only initializes the main SDL2 system, giving you limited access to SDL2 base functionality. Thevideo oraudio subsystems are only initialized whenvsdl.gfx orvsdl.audio are imported. This allows you to only activate the subsystems that are important to your project.

If an extension library is loaded (vsdl.image,vsdl.mixer,vsdl.ttf), the required runtime binaries must be installed or provided along with the build.

Contributing / Support

This project was developed as a way of improving my understanding of V & C. I will not be providing active support for the project, but I'll happily accept any pull requests. Use at your own discretion!

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp