
AKA Chris, is a software developer from Athens, Greece. He started programming with basic when he was very young. He lost interest in programming during school years but after an unsuccessful career in audio, he decided focus on what he really loves which is technology.
He loves working with older languages like C and wants to start programming electronics and microcontrollers because he wants to get into embedded systems programming.
I finished my study late today and didn't work much on my application. Here's what I did today:
- I defined macros for the screen's width and height size and mouse button values
#define LEFT_MOUSE_BUTTON 1
#define RIGHT_MOUSE_BUTTON 4
#define SCREEN_WIDTH 1280
#define SCREEN_HEIGHT 720
- I added mouseX, and mouseY float variables to get the current position of the mouse, added a Uint32 buttons variable to get which mouse button is pressed,
float mouseX, mouseY;
Uint32 buttons;
- Used the PumpEvents() function to get the latest input event and the SDL_GetMouseState() to update mouseX, and mouseY as well as get which button is pressed:
SDL_PumpEvents();
buttons = SDL_GetMouseState(&mouseX, &mouseY);
- Added conditional statements for the button presses:
if (buttons == LEFT_MOUSE_BUTTON)
{
std::cout << "Pressed Button: " << buttons << std::endl;
std::cout << "Mouse X: " << mouseX << "Mouse Y: " << mouseY << std::endl;
}
if (buttons == RIGHT_MOUSE_BUTTON)
{
std::cout << "Pressed the left button" << std::endl;
}
- Updated the window creation by adding the new macros I created:
window = SDL_CreateWindow("Rebuild Back Better",
SCREEN_WIDTH,
SCREEN_HEIGHT,
0);




