sdl-2

C++ SDL2 how to color individual tiles

心已入冬 提交于 2021-02-10 16:29:25
问题 I'm learning C++ and SDL2 by programming a classic roguelike . Right now I build the map by rendering part of a tiles.png image like this one: I followed lazyfoo's tiling tutorial and it works, but I would like to be able to change each tile background and foreground colors. I can change the full texture colors doing something like this other tutorial, but what if I want, say, a brown door somewhere and a gray one somewhere else? What's the best approach here? Obviously I can't have hundreds

C++ SDL2 how to color individual tiles

亡梦爱人 提交于 2021-02-10 16:28:59
问题 I'm learning C++ and SDL2 by programming a classic roguelike . Right now I build the map by rendering part of a tiles.png image like this one: I followed lazyfoo's tiling tutorial and it works, but I would like to be able to change each tile background and foreground colors. I can change the full texture colors doing something like this other tutorial, but what if I want, say, a brown door somewhere and a gray one somewhere else? What's the best approach here? Obviously I can't have hundreds

Where do one start on deploying C++ code?

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-29 21:59:56
问题 I just want to send some trivial SDL apps that I made to my non-coder friends. I googled a bit but all I get is more confusion. I genuinely don't know what I should do and where to start. Some said I would need to use Make/Cmake kind of stuff, some said use some sort of installer like NSIS or INNO Setup, some said I just need to put all the libraries in the folder that I would send to end user. I tried the last one on a fresh Windows VM, It asked for weird dlls that I don't know what they are

C++ SDL2: How to render rects into multiple viewports

旧城冷巷雨未停 提交于 2021-01-29 13:52:42
问题 I am new into SDL2(version 2.0.10) and I teach it from Lazy Foo tutorial. In Lesson of The ViewPort example code render me only first image in left viewport and others not. Render of rects in different viewports don't work either. What I am doing wrong when I want render rects in different viewports like this: while( !quit ){ while( SDL_PollEvent( &e ) != 0 ){ if( e.type == SDL_QUIT ){ quit = true; } } //Clear screen SDL_SetRenderDrawColor( gRenderer, 0xFF, 0xFF, 0xFF, 0xFF ); SDL_RenderClear

VS auto-linking against SDL2 libraries installed with vcpkg on Windows

对着背影说爱祢 提交于 2021-01-29 07:36:04
问题 To the best of my knowledge, this isn't a duplicate of an existing question. This question is specifically about Visual Studio's auto-linking SDL2 libraries. I've installed SDL2 ( x64-windows variant) with vcpkg: vcpkg install sdl2 --triplet x64-windows And I've made vpkg libraries available to Visual Studio: vcpkg integrate install My VS 2019 project is configured to use the Console subsystem, and my main program looks like that: #define SDL_MAIN_HANDLED #include <SDL2/SDL.h> int main(int,

VS auto-linking against SDL2 libraries installed with vcpkg on Windows

北慕城南 提交于 2021-01-29 07:31:29
问题 To the best of my knowledge, this isn't a duplicate of an existing question. This question is specifically about Visual Studio's auto-linking SDL2 libraries. I've installed SDL2 ( x64-windows variant) with vcpkg: vcpkg install sdl2 --triplet x64-windows And I've made vpkg libraries available to Visual Studio: vcpkg integrate install My VS 2019 project is configured to use the Console subsystem, and my main program looks like that: #define SDL_MAIN_HANDLED #include <SDL2/SDL.h> int main(int,

What does SDL_Init exactly do?

你离开我真会死。 提交于 2021-01-29 01:42:51
问题 So, I started using SDL about a year ago, and I just thought SDL_Init initialized SDL's subsytems ( as written here : https://wiki.libsdl.org/SDL_Init ), and that I HAD to call it before anything else. But today, I realized that in a fairly big project, I just forgot to call it, and I never had any problem : everything works perfectly. So I just wonder what it does, since I apparently don't need it to use the library ? 回答1: SDL_Init does indeed initialize the SDL's subsystems. In fact, it

What does SDL_Init exactly do?

感情迁移 提交于 2021-01-29 01:42:42
问题 So, I started using SDL about a year ago, and I just thought SDL_Init initialized SDL's subsytems ( as written here : https://wiki.libsdl.org/SDL_Init ), and that I HAD to call it before anything else. But today, I realized that in a fairly big project, I just forgot to call it, and I never had any problem : everything works perfectly. So I just wonder what it does, since I apparently don't need it to use the library ? 回答1: SDL_Init does indeed initialize the SDL's subsystems. In fact, it

What does SDL_Init exactly do?

随声附和 提交于 2021-01-29 01:40:31
问题 So, I started using SDL about a year ago, and I just thought SDL_Init initialized SDL's subsytems ( as written here : https://wiki.libsdl.org/SDL_Init ), and that I HAD to call it before anything else. But today, I realized that in a fairly big project, I just forgot to call it, and I never had any problem : everything works perfectly. So I just wonder what it does, since I apparently don't need it to use the library ? 回答1: SDL_Init does indeed initialize the SDL's subsystems. In fact, it

What does SDL_Init exactly do?

北战南征 提交于 2021-01-29 01:37:24
问题 So, I started using SDL about a year ago, and I just thought SDL_Init initialized SDL's subsytems ( as written here : https://wiki.libsdl.org/SDL_Init ), and that I HAD to call it before anything else. But today, I realized that in a fairly big project, I just forgot to call it, and I never had any problem : everything works perfectly. So I just wonder what it does, since I apparently don't need it to use the library ? 回答1: SDL_Init does indeed initialize the SDL's subsystems. In fact, it