Compare commits

...
3 Commits
Author SHA1 Message Date
tTh f15aad0c2e découverte de SDL2 2024-09-07 15:36:26 +02:00
tTh 3bd50b2ab5 dessin : un nouveau chapitre 2024-09-05 20:16:19 +02:00
tTh a83761fea8 add chapter label 2024-09-05 00:52:25 +02:00
7 changed files with 80 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
\chapter{Dessiner}
\label{chap:dessin}
%
% new: Thu Sep 5 18:14:20 UTC 2024
%
% =======================================================================
\section{xpaint} \index{xpaint }
% =======================================================================
+1
View File
@@ -1,4 +1,5 @@
\chapter{Photographie} \chapter{Photographie}
\label{chap:photos}
\index{Photo} \index{Photo}
Le domaine de la photographie numérique est vaste. Le domaine de la photographie numérique est vaste.
+1
View File
@@ -0,0 +1 @@
strangebug
+4
View File
@@ -0,0 +1,4 @@
strangebug: strangebug.c Makefile
gcc -Wall $< -lSDL2 -o $@
+11
View File
@@ -0,0 +1,11 @@
# Simple DirectMedia Layer
The *[Simple DirectMedia Layer](https://libsdl.org/)
is a cross-platform development library designed
to provide low level access to audio, keyboard, mouse, joystick, and
graphics hardware via OpenGL/Direct3D/Metal/Vulkan.*
Paf, premier essai, [premier souci](strangebug.md) **:)**
+40
View File
@@ -0,0 +1,40 @@
/*
* Strange Bug ?
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <SDL2/SDL.h>
int main(int argc, char *argv[])
{
SDL_Window *win;
SDL_Renderer *rend;
int idx, idy;
if(SDL_CreateWindowAndRenderer(256, 256, SDL_WINDOW_SHOWN, &win, &rend))
{
fprintf(stderr, "Err SDL_CreateWindowAndRenderer : %s", SDL_GetError());
exit(1);
}
SDL_SetRenderDrawColor(rend, 255, 0, 0, 0);
SDL_RenderClear(rend);
SDL_RenderPresent(rend);
for (idx=0; idx<256; idx++) {
for (idy=0; idy<256; idy++) {
SDL_SetRenderDrawColor(rend, 127, idx, idy, 0);
SDL_RenderDrawPoint(rend, idx, idy);
}
SDL_RenderPresent(rend);
// SDL_Delay(50); /* Is the bug here ? */
}
SDL_RenderPresent(rend);
sleep(30);
SDL_DestroyRenderer(rend);
SDL_DestroyWindow(win);
return 0;
}
+11
View File
@@ -0,0 +1,11 @@
# `strangebug`, ou le bug étrange
Pour mes premiers pas dans la sdl, j'ai voulu faire un gradient de couleur
dans une petite fenêtre, quelque chose de vraiment simple, me diriez-vous,
mais qui cache une chose étrange...
Voici le [Code source](strangebug.c). Si vous décommentez la ligne
marquée, seul une colonne sur deux est correctement tracée...
*Please explain*.