I tried many ways and couldn’t install it. How can I install it? Is there a source that explains it step by step?
assuming your talking about adding it as a dependency
I couldn’t understand what was in the link you gave. How to set it up? How will it work? Is there a step-by-step article or video explaining this?
Have you looked at the examples?
I think wanting a video tutorial for every specific thing is a trap that can keep you from learning how to progress and become self-reliant, I think instead it is better to learn how to utilize general learning materials (including videos, blog posts / articles, etc.) to build your skills and fill in gaps in your knowledge.
Let us know what topics specifically you need help with, so we can point you to resources that are about that topic. We don’t know what you know, or don’t know.
It doesn’t make sense to make a “how to start from nothing” tutorial for every project you could create with a programming language.
Here are some general learning resources:
Do these help you?
If not, what do you need help with?
I can’t use the sld3 library with zig. I looked at articles and videos about what to do at first. and none of them helped me. I asked chatgpt. All of the dozens of suggestions he gave me came up with errors. I can’t find a solution. I couldn’t even get an sdl output that would write text to the screen at the simplest level. I’m looking for a source that will explain this step by step. There aren’t many sources about the zig language. The examples you gave are quite complicated and are made into games. I couldn’t include the sld3 library either.
- create a new zig project using
zig init
- add the sdl dependency by using
zig fetch
- add the dependency and import to your
build.zig
- add the
@import
to the code - change the code to be equivalent to a simple sdl example
I think all these steps are simple steps you should be able to figure out mostly on your own, by making use of the learning resources / using existing answers, or at least tell us where you got error messages.
I am not going to spoon-feed you a customized tutorial, get to work and ask questions if you get stuck.
Did you try using Castholm’s port that was linked above? It’s pretty much plug and play.
Also, you can compile SDL3 with a C compiler and just link the static library with zig. This is the closest to the intended way of using the library.
You haven’t made it clear how experienced you are with tools. In order to help you, we would need to know if you are experienced with C, SDL or Zig.
- add the sdl dependency by using
zig fetch
- How do I do this step?
Castholm’
I don’t understand how to use this.
I have little knowledge about c and zig. I am a beginner.
The zig fetch line under the usage headline.
C:\Users\XX>zig fetch --save git+https://github.com/castholm/SDL.git
C:\Users\XX\AppData\Local\zig\tmp\a675f85c09fa1f87\build.zig.zon:5:14: error: expected string literal
.name = .sdl,
what is the output of?:
zig version
zig version
0.13.0
You need to get zig 0.14.0 the readme of sdl states that it requires it. (at least that is simpler than using an older version of the sdl library)
info: resolved to commit
I did the fetch step. This article appeared. I made the version 15.0. How do I do the next step?
This one? Pretty much like here:
I copied and pasted the codes into a file called build.zig. You said add and import the dependency. What does this mean and how should I do it?
You don’t need to add a module import, that was before I saw how the breakout example just uses @cImport
, I think you can continue with this:
Or you can do what
does and remove everything you don’t need.
I think that are basically two different styles of using the library.
The first is using callbacks and the breakout example is using a while loop.
I don’t understand. Where do I add the last codes you gave me?
Your src/main.zig
needs code, personally I would start with the breakout code and step by step remove all the things that aren’t needed.