Page 59 of 68

Re: Noob learns to code in 3 months

Posted: September 20th, 2017, 1:04 am
by chili
No branches, only dreams now.

Each tutorial has important commits tagged (usually the end of the tutorial commit). You just create a branch at the commit you're interested in, using the tags as guideposts.

Re: Noob learns to code in 3 months

Posted: September 20th, 2017, 4:57 pm
by Yumtard
Yeah figured it out :)

Had nothing to do at school today so watched 10, 11 and 12. Just watched them through without pausing to get the idea. Found these really interesting so decided just watching through them once and then watch each of them more carefully would be a good idea.

rewatched 10, didn't code along because I wanted to make it more of a challenge afterwards. But cheated a bit by writing down a guideline which I peaked at while coding. Will try to do it all over again without the guideline before moving on to 11.

guideline
Spoiler:
surface class -
array of colors (pixels)
width and height
cpy cstr and copy assignment
putpixel
getpixel
getwidth/height
constructor

in gfx:
drawsprite()

include chiliwin to get access to bitmapfileheader and info

in the constructor:
read in the fileheader
read in infoheader
assert bitcompression == BI_RGB

set width/height and load pixels in array

bfOffBits is where the offset from beginning of file to where the pixel data starts

padding = (4 - (width * 3) % 4) % 4

Re: Noob learns to code in 3 months

Posted: September 20th, 2017, 7:57 pm
by Yumtard
Success!

Took a break for a few hours before trying to write the code without any cheating. Took the break so everything wouldn't be superfresh in my mind and me just remembering exactly what I needed to do. This way I had to think a bit more what I needed.

Decided to record it because 1. I'm a nerd and enjoy watching speedcoding and 2. I felt like recording it helped me not get tempted to cheat.

here's me doing the "challenge" in 8x speed.

https://www.youtube.com/watch?v=z-vtupqvbFI

will have a closer look at 11 and maybe 12 tomorrow unless I get a bunch of school stuff to do.

Re: Noob learns to code in 3 months

Posted: September 21st, 2017, 2:31 pm
by chili
11, 12, and 13 (maybe not 13) should be a bit of deja-vu for you considering that you had this stuff in your Shoot-Em-Up balls game. Though it's nice to see exactly where all that Surface and sprite routine comes from and the entire process of its creation, isn't it? :)


The timelapse coding looks cool, music suits!

14 is gonna teach how to make your own template classes and template functions. Good shit.

Re: Noob learns to code in 3 months

Posted: September 21st, 2017, 3:48 pm
by albinopapa
chili wrote:11, 12, and 13 (maybe not 13) should be a bit of deja-vu for you considering that you had this stuff in your Shoot-Em-Up balls game. Though it's nice to see exactly where all that Surface and sprite routine comes from and the entire process of its creation, isn't it? :)


The timelapse coding looks cool, music suits!

14 is gonna teach how to make your own template classes and template functions. Good shit.
Are you going to cover template specialization?

Re: Noob learns to code in 3 months

Posted: September 21st, 2017, 8:31 pm
by Yumtard
chili wrote:11, 12, and 13 (maybe not 13) should be a bit of deja-vu for you considering that you had this stuff in your Shoot-Em-Up balls game. Though it's nice to see exactly where all that Surface and sprite routine comes from and the entire process of its creation, isn't it? :)


The timelapse coding looks cool, music suits!

14 is gonna teach how to make your own template classes and template functions. Good shit.
Yes and no. The thing with sprite sheets and just drawing parts of the picture was new to me.
Also back then I didn't really understand how to animation class worked, just used it.

Glad you liked the timelapse because I made an other one! haha. This one is long and nobody should watch it unless they're bored and have too much time on their hands or are into the music.

I had nothing to do so made another challenge to do everything from loading bitmaps to animated sprites without cheating. Had a little trouble along the way but went alright, took a bit more than 2 hours.
Don't worry, these recordings wont become a regular thing :lol: (probably last one)
https://www.youtube.com/watch?v=awTOLUh2raI

Will watch 13 tomorrow, then do maths for a while

Re: Noob learns to code in 3 months

Posted: September 22nd, 2017, 1:14 am
by chili
albinopapa wrote:
chili wrote:11, 12, and 13 (maybe not 13) should be a bit of deja-vu for you considering that you had this stuff in your Shoot-Em-Up balls game. Though it's nice to see exactly where all that Surface and sprite routine comes from and the entire process of its creation, isn't it? :)


The timelapse coding looks cool, music suits!

14 is gonna teach how to make your own template classes and template functions. Good shit.
Are you going to cover template specialization?
Not in the introduction to templates. Information overload is seldom a good thing ;)

Re: Noob learns to code in 3 months

Posted: September 22nd, 2017, 10:10 am
by Chrajdal
Yumtard wrote:Success!

Took a break for a few hours before trying to write the code without any cheating. Took the break so everything wouldn't be superfresh in my mind and me just remembering exactly what I needed to do. This way I had to think a bit more what I needed.

Decided to record it because 1. I'm a nerd and enjoy watching speedcoding and 2. I felt like recording it helped me not get tempted to cheat.

here's me doing the "challenge" in 8x speed.

https://www.youtube.com/watch?v=z-vtupqvbFI

will have a closer look at 11 and maybe 12 tomorrow unless I get a bunch of school stuff to do.
Hey, I noticed that around 1:00 in that clip you wrote assignment operator. What happens when you do the following:

Surface a ("anyfilename.bmp");
a = a;

The universe will blow ^^

Check this: https://isocpp.org/wiki/faq/assignment-operators

Btw: I love your idea about not being tempted to cheat!

Re: Noob learns to code in 3 months

Posted: September 22nd, 2017, 10:19 am
by chili
Chrajdal wrote:
Yumtard wrote:Success!

Took a break for a few hours before trying to write the code without any cheating. Took the break so everything wouldn't be superfresh in my mind and me just remembering exactly what I needed to do. This way I had to think a bit more what I needed.

Decided to record it because 1. I'm a nerd and enjoy watching speedcoding and 2. I felt like recording it helped me not get tempted to cheat.

here's me doing the "challenge" in 8x speed.

https://www.youtube.com/watch?v=z-vtupqvbFI

will have a closer look at 11 and maybe 12 tomorrow unless I get a bunch of school stuff to do.
Hey, I noticed that around 1:00 in that clip you wrote assignment operator. What happens when you do the following:

Surface a ("anyfilename.bmp");
a = a;

The universe will blow ^^

Check this: https://isocpp.org/wiki/faq/assignment-operators

Btw: I love your idea about not being tempted to cheat!
Yeah I mention that case on the wiki page. Should have covered it in the tutorial but forgot about it!

Re: Noob learns to code in 3 months

Posted: September 22nd, 2017, 10:52 am
by Yumtard
interesting! Never considered self assignment