#2d graphics

33 messages · Page 1 of 1 (latest)

edgy lynxBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

rancid sequoia
#

okay so

#

you can create a 2d array with this:

std::array<std::array<int, 2>, 3> asd{};
#

its the same as:

int asd[3][2];```
#

but the second one is the C way and allowing you to use an illegal memory location, resulting into a segfault

#

i guess so, you have 3 arrays which then contain 2 arrays

#

wait hold on

#

yeah

#

yeah well im not sure what you trying to do

#

oh

#

hm

#

like?

#

you could do that

#

i dont know much about computer graphics

#

i would advise you to look into opengl if you havent already

normal pier
#

well, opengl wouldn't be rather easy, more likely SDL, although... well, I feel you, somehow in time things got harder, when one started learning in DOS using Turbo C++ there was just built-in simple to use graphics library

#

now things seem to be a little more complicated

molten sparrow
#

yeah graphics has gotten a lot more sophisticated. but there are ofc libraries you can use. SFML, SDL, Allegro, raylib, pixel toaster, …

topaz ferry
molten sparrow
#

yeah but you need a way to put pixels onto the screen

#

that part has gotten a lot more complex

#

compared to the olden days where you'd just get a pointer to the frame buffer and write to it ^^

#

these days, you're typically sitting on top of a preemptive multitasking os with a desktop experience and a compositing window manager on top of a gpu. so getting pixels onto the screen involves creating a window and getting to draw into that window, which generally involves dealing with system apis, message pumping, swap chains, gpu-side buffers, etc.

normal pier
#

I could even still recommend starting with DOS

molten sparrow
#

I certainly wouldn't ^^

normal pier
#

although I would need to find a good tutorial that gives the complete toolset

#

with a modern compiler port

#

to not go into memory models, segments, i.e. at least protected mode by default

molten sparrow
#

yeah that stuff is a mess

normal pier
#

it's so lovely to plot pixel just by putting it by ((unsigned char *)0xa0000)[320 * y + x] = color

#

and that mentioned graphics library in Turbo C++ was also easy and built-in

#

(although Turbo Pascal had a nicer syntax for everything)

edgy lynxBOT
#

This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.