I started to follow Hand Made Hero again, here is the source code from Day 5. I also formatted it with clang.
win32_handmade.cpp
#include <stdint.h>#include <windows.h> #define internal static #define local_persist static #define global_variable static typedef int8_t int8; typedef int16_t int16; typedef int32_t int32; typedef int64_t int64; typedef uint8_t uint8; // 1 byte typedef uint16_t uint16; // 2 bytes typedef uint32_t uint32; // 3 bytes typedef uint64_t uint64; // 4 bytes struct win32_offscreen_buffer { // Pixels are alwasy 32-bits wide, Memory Order BB GG RR XX BITMAPINFO Info; void *Memory; int Width; int Height; int Pitch; }; struct win32_window_dimension { int Width; int Height; }; global_variable bool GlobalRunning; global_variable win32_offscreen_buffer GlobalBackbuffer; win32_window_dimension Win32GetWindowDimension(HWND Window) { win32_window_dimension Result; RECT ClientRect; GetClientRect(Window, &ClientRect); Result.
This whole video is in Q&A form, which is quite enjoyable to watch.
I strongly agree with Linus in the following thoughts:
Passion, hard work and attention to details are extremely important. Whether you have vision or not is totally another story. People who easily get offended, should be offended.
Generic programming is an important idea in programming. In languages like Java and C++, it can be done easily. In this post, I show how to do it in plain old C.
We use the classic stack implementation. First, we implement an int version.
This is stack.h:
typedef struct { int *elems; int logLength; int allocLengh; } stack; void StackNew(stack *s); void StackDispose(stack *s); void StackPush(stack *s, int value); int StackPop(stack *s); This is stack.
The operator flatmap in RxJava is a tough topic if you are not familiar with functional style.
After reading all the articles and tutorials and even worked with RxJava for almost a year, I’m still not quite confident about it. I sure know how to and when to use it, but the understanding seems always shallow.
Until I read the flatmap in the Structure and Interpretation of Computer Programs.
The key is to understand the word flat.
Want to Be a Video Game Designer? You MUST Read This First Wouldn’t it be great to turn your lifelong love of video games into a career? That’s the dream of almost every gamer. Consequently, jobs are incredibly competitive. What qualifications do you need to get a leg up on the competition? Here is some information to get you started.
What Is the Job and Salary Outlook? The average yearly salaries for workers in the video game industry ranged from $49K for quality assurance testers to $107K for executives according to stats from the United States Bureau of Labor Statistics.