Play tool
ascii paint's itch.io pageHow many characters of code did you use?
551
Include your code here, if you'd like to show it off!
#include<SDL.h>
#include<SDL_TTF.h>
int main(int argc,char*args[]){TTF_Init();SDL_Window*w=SDL_CreateWindow(0,0,25,500,500,2);SDL_Renderer*r=SDL_CreateRenderer(w,1,0);TTF_Font*f=TTF_OpenFont("a.ttf",10);SDL_Color c={255,255,255};SDL_Surface*s=TTF_RenderText_Solid(f,"|",c);SDL_Event e;SDL_Texture*t;while(1){int x,y;t=SDL_CreateTextureFromSurface(r,s);SDL_Rect d={x-=11,y-=10,22,10};SDL_GetMouseState(&x,&y);if(SDL_PollEvent(&e)){if(SDL_GetMouseState(0,0)&SDL_BUTTON(1)){SDL_RenderCopy(r,t,0,&d);}if(e.type==SDL_QUIT){break;}}SDL_RenderPresent(r);}}
Leave a comment
Log in with itch.io to leave a comment.
Comments
No one has posted a comment yet