Hopefully this is the right place to post. For some reason in my game, bitmaps are not being placed correctly.
Here I'm trying to draw a Bitmap at 200, 200 (width is 16x16) but instead its being drawn at roughly 194, 186
However when I try drawing it at 0,0, it draws correctly:
I pretty much followed exactly the MSDN articles, here's the code:
ResourceLoader::GetImageAssets().at(4); D2D1_POINT_2F upperLeftCorner = D2D1::Point2F(200.f, 200.f); D2D1_SIZE_F size = ResourceLoader::GetImageAssets().at(4).Bitmap->GetSize(); target->DrawBitmap( ResourceLoader::GetImageAssets().at(4).Bitmap, D2D1::RectF( upperLeftCorner.x, upperLeftCorner.y, upperLeftCorner.x + size.width, upperLeftCorner.y + size.height), 1.0f );
ResourceLoader is some custom class, GetImageAssets is a vector with a class called ImageAsset, ImageAsset contains the Bitmap.
I've tried with no defined transforms and with the Matrix3x4 identity transform with still the same result.
Edit: It appears that the more it strays from 0,0, the larger the "offset". It doesn't seem to be some static x,y offset/transform.
Edit2: Same issue with DrawRectangle. Seems to be an issue with the Direct2D drawing and not the DrawBitmap method itself.
Edit3: Fixed. I was not creating my HwndRenderTarget correctly.