if (CheckCollisionPointRec(mousePosition,canvas))
//checks if mouse position is within canvas
{
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT))
//check if left mouse button is pressed down
{
float relativeX = mousePosition.x - canvasX;
float relativeY = mousePosition.y - canvasY;
//Checks the relative positions of the x and y axis of the mouse to the canvas's x and y coordinates.
// Draw a pixel at the mouse position within the canvas
DrawPixel((int)relativeX, (int)relativeY, BLACK); // won't draw. Hence.
}
}
Вот в этом и заключается проблема. Этот блок находится внутри блока BeginDrawing(). Кажется, все работает нормально, кроме функции DrawPixel(). Я пробовал разные варианты данных функций и пробовал перемещать элементы вверх и вниз.
[code] if (CheckCollisionPointRec(mousePosition,canvas)) //checks if mouse position is within canvas { if (IsMouseButtonDown(MOUSE_BUTTON_LEFT)) //check if left mouse button is pressed down { float relativeX = mousePosition.x - canvasX; float relativeY = mousePosition.y - canvasY; //Checks the relative positions of the x and y axis of the mouse to the canvas's x and y coordinates.
// Draw a pixel at the mouse position within the canvas DrawPixel((int)relativeX, (int)relativeY, BLACK); // won't draw. Hence. } } [/code] Вот в этом и заключается проблема. Этот блок находится внутри блока BeginDrawing(). Кажется, все работает нормально, кроме функции DrawPixel(). Я пробовал разные варианты данных функций и пробовал перемещать элементы вверх и вниз.