Coding Pong in C from Scratch | Drawing to a Window | Ep. 1

Поділитися
Вставка
  • Опубліковано 21 лис 2024

КОМЕНТАРІ • 44

  • @heshamyoussef8654
    @heshamyoussef8654 15 днів тому +11

    Ah yes, SDL2 programming in pure C, keep up the good work!

  • @Ensy46
    @Ensy46 7 днів тому +1

    Thank you, I was looking for a tutorial that clearly explains how sdl works and this is by far the best I've found🙏

  • @rockeywerewolf
    @rockeywerewolf 14 днів тому +3

    From scratch with SDL... Not what I expected when saw that title but it is still impessive enough. Keep going bro!

    • @Lin_The_Cat_
      @Lin_The_Cat_ 11 днів тому +1

      I hope you weren't expecting him to just go full rawdog and program the entire graphics engine via WIN32 lol As a C programmer, there's a reason why I stay on Linux. Unless my livelihood depended on it (e.g.: as a job requirement), I would NOT touch WIN32 with a 10 foot pole.

  • @aventyrskonsulterna
    @aventyrskonsulterna 8 днів тому

    Da*n! Really nice! Trying to learn C as well, and this helped me a lot! Love that you don't know everything, like a real world scenario! Looking forward to the next ep!

  • @Acodeful
    @Acodeful 17 днів тому +2

    Good job bro I really love these types of videos because I keep learning so much from them. Keep it up!

  • @l.l.ressurection7968
    @l.l.ressurection7968 17 днів тому +14

    It is very satisfying to watch videos like this, where you don't just have a code ready and then just write it again in another file. Keep it up my friend!! I would just suggest that the facecam could be a slightly smaller or you could position at the bottom-right side of the window. It would be easier to read the code. Really excited for the next videos!! 👾

  • @0daydreams
    @0daydreams 16 днів тому +2

    You just motivated me to go back to game dev and do some funny stuff :D

  • @Nurof3n_
    @Nurof3n_ 4 дні тому

    great video!

  • @insadeyt
    @insadeyt 14 днів тому

    ahh i am loving this video so far i have watched this video like 5 time idk... every time i learn something new thanks man ... waiting for next episode 😀

    • @HirschDaniel
      @HirschDaniel  14 днів тому

      Glad you enjoy it so much! Next episode is released on Monday!

  • @SBcode-s3n
    @SBcode-s3n 5 днів тому

    amazing video

  • @silvermig
    @silvermig 17 днів тому +1

    Nice, I like the idea of playing in SDL with C. At least to code classics games. A lot of tutorials out there are with C++.

  • @alpdemircioglu8899
    @alpdemircioglu8899 16 днів тому

    Nice to watch something like this

  • @Lin_The_Cat_
    @Lin_The_Cat_ 11 днів тому

    I love SDL. It's powerful, yet not imposing. By that I mean:
    Powerful:
    You can do so much with it, and it's my goto whenever I'm making either something GUI based or something whose utility doesn't *need* a GUI, but would really benefit from a realtime graphical representation of what's going on in the code.
    Not Imposing:
    All of the data types and function names are pretty concise and describe what they're doing really well, to the point where their documentation is just icing on the cake. Their doc game is really strong even under normal standards, but it's exceptional when you take into consideration that SDL is FOSS. (not to dog on other FOSS libraries whose documentation is admittedly either barren (looking at you, XLib), vague, or just plain obtuse)

    • @HirschDaniel
      @HirschDaniel  11 днів тому

      I enjoy it as well and thinks it's an awesome graphics library for C. Admittedly, I'm a complete C newbie and don't know much, but the bare fact that I am able to navigate around the docs and implement something meaningful with it is already awesome.

  • @downtimetm
    @downtimetm 15 днів тому

    i found it really interesting, please release part 2 soon

    • @HirschDaniel
      @HirschDaniel  15 днів тому

      Part 2 is planned to be released on Monday!

  • @Kveldrunari
    @Kveldrunari 17 днів тому

    Thank you for sharing this!

  • @ZODDBERR
    @ZODDBERR 17 днів тому

    awesome content! keep going :-)

  • @suvetar
    @suvetar 14 днів тому

    Hey man! Love the Video. The problem (IIRC) with your events is that the "typedef struct SDL_QuitEvent { ...} SDL_QuitEvent" is that you're comparing against the type (struct) definition itself, not an instance of it. Like trying to instantiate an abstract class, metaphorically speaking. the .type you're trying to read is just the description of the memory layout of the struct, you need an instance of the struct to actually have some value in memory.
    Hope this helps!

    • @HirschDaniel
      @HirschDaniel  14 днів тому

      Hi, thanks! I am comparing the event type to SDL_QUIT, though, which is a Uint32 constant. Or are we looking at different code snippets?

    • @HirschDaniel
      @HirschDaniel  14 днів тому

      Ah, I got you now. I was comparing to SDL_QuitEvent initially, but fixing it up a couple minutes later.

  • @BogdanKustan
    @BogdanKustan 8 днів тому

    Part about events was painful to watch :). Overall nice video

    • @HirschDaniel
      @HirschDaniel  8 днів тому +1

      haha, there is much more pain to be found in my other videos. This one went comparably smoothly. Thanks!

  • @neonaradan6001
    @neonaradan6001 17 днів тому

    Thank you!!

  • @jinkijung6401
    @jinkijung6401 6 днів тому

    Thank you. what LSP for SDL2 are you using ?

    • @HirschDaniel
      @HirschDaniel  6 днів тому

      I am using "ALE" which is a vim plugin. And ALE is able to auto-detect the SDL2 library definitions based on the header in the .c file I think. I haven't configured anything for SDL2 specifically.

    • @jinkijung6401
      @jinkijung6401 6 днів тому

      @@HirschDaniel Thank you Daniel

  • @thenxker
    @thenxker 12 днів тому

    how did you manage to put sdl in an include folder without using a ide like visual studio? id really like to switch back to vs code, but it wont let me use sfml because i have it somewhere else on my computer

    • @HirschDaniel
      @HirschDaniel  12 днів тому

      I simply followed the "Installing SDL" page of the official documentation. It was just an "apt install" command followed by using the compilations flags (shown in the video and in the docs). I have no idea about any IDE specifics

    • @thenxker
      @thenxker 12 днів тому

      @@HirschDaniel I see, thank you man :)

  • @stefumies
    @stefumies 10 днів тому

    Shame this wont work on Silicon Macs, there is an issue linking to SDL, and so far no solution has been accepted, they are still working on it.

    • @HirschDaniel
      @HirschDaniel  10 днів тому

      Urgh, really? Maybe its possible to workaround that in a virtual linux environment. But yeah, not good.

  • @t-ree
    @t-ree 14 днів тому

    Why are you using tmate?

    • @HirschDaniel
      @HirschDaniel  14 днів тому

      Do you mean tmux? Usually I have several panes open simultaneously, just not this time

    • @t-ree
      @t-ree 14 днів тому

      @HirschDaniel Tmate, and tmux literally has the same gui, so I got confused sorry!

  • @jinkijung6401
    @jinkijung6401 5 днів тому

    Following your code in macOS - to be exact, hackintosh - sonoma, I created windows and run. but no windows showed up even after SDL_Delay(5000). Any idea ?

    • @HirschDaniel
      @HirschDaniel  5 днів тому

      Did you include the SDL_Init command at the beginning of the main method?

    • @jinkijung6401
      @jinkijung6401 5 днів тому

      @@HirschDaniel
      just three lines.
      #include
      int main() {
      SDL_InitSubSystem(SDL_INIT_VIDEO);
      SDL_CreateWiindow("Title",SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,640,480,0);
      SDL_Delay(5000);
      return 0;
      }

    • @jinkijung6401
      @jinkijung6401 5 днів тому

      It must be a macOS specific issue. If I run the same code in WSL, it works. Thank you.

    • @HirschDaniel
      @HirschDaniel  5 днів тому

      @@jinkijung6401 Yes, that's odd. Someone else mentioned to me lately that there are weird issues when using SDL on Mac.

  • @ZODDBERR
    @ZODDBERR 17 днів тому +1

    error sound a bit annoying tho :D

    • @HirschDaniel
      @HirschDaniel  17 днів тому +1

      I'll need to figure out how to turn that one off, thanks!