11.15
This commit is contained in:
@@ -26,6 +26,9 @@ int32_t g_canvasWidth = 1024;
|
||||
int32_t g_canvasHeight = 512;
|
||||
davinci::Device g_device;
|
||||
davinci::Scene g_scene;
|
||||
int32_t g_mousePosX = 0;
|
||||
int32_t g_mousePosY = 0;
|
||||
davinci::fVector4 g_mouseColor = davinci::fVector4::BLACK;
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
//int main(int argc, char* argv[])
|
||||
@@ -160,6 +163,20 @@ SDL_AppResult SDL_AppIterate(void* appstate)
|
||||
g_adapterTexture.updateTexture(g_canvasWidth, 0, g_renderTarget.getDepthBuffer());
|
||||
g_adapterTexture.draw();
|
||||
|
||||
float mousePosX, mousePosY;
|
||||
SDL_GetMouseState(&mousePosX, &mousePosY);
|
||||
|
||||
g_mousePosX = (int32_t)(mousePosX) % g_canvasWidth;
|
||||
g_mousePosY = g_screenHeight - (int32_t)(mousePosY);
|
||||
if(g_mousePosX>=0 && g_mousePosX < g_canvasWidth && g_mousePosY >=0 && g_mousePosY < g_canvasHeight)
|
||||
{
|
||||
g_mouseColor = g_renderTarget.getColorBuffer().getPixel(g_mousePosX, g_mousePosY);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_mouseColor = davinci::fVector4::BLACK;
|
||||
}
|
||||
|
||||
//draw ui
|
||||
drawMainUI();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user