Skip to main content
added 112 characters in body
Source Link
Medals
  • 121
  • 2

I'm a beginner trying to implement a flashlight in SDL2, but can't figure out a good way to do it.

I've found a way to manipulate the background's color; changed it to dark and back to its normal colors, but this isn't the whole solution.

My main goal is a flashlight that follows the player around the map.

I thought about per-pixel drawing, but I think it will result in poor performance. Drawing a black pixel for every pixel on screen, then changing back the to the normal color to all of the pixels surrounding the player.

How do I do this correctly?(BTW, I'm using a 'SDL_Renderer', not 'SDL_Surface', i realized this can be a problem when dealing with pixels.)

I'm a beginner trying to implement a flashlight in SDL2, but can't figure out a good way to do it.

I've found a way to manipulate the background's color; changed it to dark and back to its normal colors, but this isn't the whole solution.

My main goal is a flashlight that follows the player around the map.

I thought about per-pixel drawing, but I think it will result in poor performance. Drawing a black pixel for every pixel on screen, then changing back the to the normal color to all of the pixels surrounding the player.

How do I do this correctly?

I'm a beginner trying to implement a flashlight in SDL2, but can't figure out a good way to do it.

I've found a way to manipulate the background's color; changed it to dark and back to its normal colors, but this isn't the whole solution.

My main goal is a flashlight that follows the player around the map.

I thought about per-pixel drawing, but I think it will result in poor performance. Drawing a black pixel for every pixel on screen, then changing back the to the normal color to all of the pixels surrounding the player.

How do I do this correctly?(BTW, I'm using a 'SDL_Renderer', not 'SDL_Surface', i realized this can be a problem when dealing with pixels.)

Some grammar fixes, general proofreading, and relevant tags.
Source Link
Anko
  • 13.4k
  • 10
  • 55
  • 82

Trying to How do I implement a flashlight(SDL2) in SDL2?

I'm a beginner trying to implement a flashlight in SDL2, but i can't figure out a good way of doingto do it.(I'm a beginner)

I've found a way to manipulate the background's color; changed it to dark and back to its normal colors, but this isn't the whole solution.

myMy main goal is a flashlight that follows the user's player. the user can move inside around the map, and the light needs to follow whereever it goes.

iI thought about per-pixel drawing, but iI think it will result in poor performance.. Drawing a black pixel for everypixel in theevery pixel on screen, and then changing back the to the normal color to all of the pixels surrounding the player.

any suggestionsHow do I do this correctly? thanks.

Trying to implement a flashlight(SDL2)

I'm trying to implement a flashlight in SDL2, but i can't figure out a good way of doing it.(I'm a beginner)

I've found a way to manipulate the background's color; changed it to dark and back to its normal colors, but this isn't the whole solution.

my main goal is a flashlight that follows the user's player. the user can move inside the map, and the light needs to follow whereever it goes.

i thought about per-pixel drawing, but i think it will result in poor performance.. Drawing a black pixel for everypixel in the screen, and then changing back the to the normal color to all of the pixels surrounding the player.

any suggestions? thanks.

How do I implement a flashlight in SDL2?

I'm a beginner trying to implement a flashlight in SDL2, but can't figure out a good way to do it.

I've found a way to manipulate the background's color; changed it to dark and back to its normal colors, but this isn't the whole solution.

My main goal is a flashlight that follows the player around the map.

I thought about per-pixel drawing, but I think it will result in poor performance. Drawing a black pixel for every pixel on screen, then changing back the to the normal color to all of the pixels surrounding the player.

How do I do this correctly?

Source Link
Medals
  • 121
  • 2

Trying to implement a flashlight(SDL2)

I'm trying to implement a flashlight in SDL2, but i can't figure out a good way of doing it.(I'm a beginner)

I've found a way to manipulate the background's color; changed it to dark and back to its normal colors, but this isn't the whole solution.

my main goal is a flashlight that follows the user's player. the user can move inside the map, and the light needs to follow whereever it goes.

i thought about per-pixel drawing, but i think it will result in poor performance.. Drawing a black pixel for everypixel in the screen, and then changing back the to the normal color to all of the pixels surrounding the player.

any suggestions? thanks.