mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 23:07:18 +00:00
[client] overlay: use utility function to get ImGui rectangle
This commit is contained in:
parent
628bdab21b
commit
56308fcbd1
@ -120,6 +120,7 @@ set(SOURCES
|
||||
src/kb.c
|
||||
src/egl_dynprocs.c
|
||||
src/eglutil.c
|
||||
src/overlay_utils.c
|
||||
|
||||
src/overlay/fps.c
|
||||
src/overlay/graphs.c
|
||||
|
28
client/include/overlay_utils.h
Normal file
28
client/include/overlay_utils.h
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright (C) 2017-2021 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., 59
|
||||
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _H_LG_OVERLAY_UTILS_
|
||||
#define _H_LG_OVERLAY_UTILS_
|
||||
|
||||
#include "common/types.h"
|
||||
|
||||
void overlayGetImGuiRect(struct Rect * rect);
|
||||
|
||||
#endif
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "interface/overlay.h"
|
||||
#include "cimgui.h"
|
||||
#include "overlay_utils.h"
|
||||
|
||||
#include "../main.h"
|
||||
|
||||
@ -54,13 +55,7 @@ static int fps_render(void * udata, bool interactive, struct Rect * windowRects,
|
||||
atomic_load_explicit(&g_state.fps, memory_order_relaxed),
|
||||
atomic_load_explicit(&g_state.ups, memory_order_relaxed));
|
||||
|
||||
ImVec2 size;
|
||||
igGetWindowPos(&pos);
|
||||
igGetWindowSize(&size);
|
||||
windowRects[0].x = pos.x;
|
||||
windowRects[0].y = pos.y;
|
||||
windowRects[0].w = size.x;
|
||||
windowRects[0].h = size.y;
|
||||
overlayGetImGuiRect(windowRects);
|
||||
igEnd();
|
||||
|
||||
return 1;
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "ll.h"
|
||||
#include "common/debug.h"
|
||||
#include "overlay_utils.h"
|
||||
|
||||
struct GraphState
|
||||
{
|
||||
@ -138,14 +139,7 @@ static int graphs_render(void * udata, bool interactive,
|
||||
sizeof(float));
|
||||
};
|
||||
|
||||
ImVec2 size;
|
||||
igGetWindowPos(&pos);
|
||||
igGetWindowSize(&size);
|
||||
windowRects[0].x = pos.x;
|
||||
windowRects[0].y = pos.y;
|
||||
windowRects[0].w = size.x;
|
||||
windowRects[0].h = size.y;
|
||||
|
||||
overlayGetImGuiRect(windowRects);
|
||||
igEnd();
|
||||
return 1;
|
||||
}
|
||||
|
37
client/src/overlay_utils.c
Normal file
37
client/src/overlay_utils.c
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright (C) 2017-2021 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., 59
|
||||
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "overlay_utils.h"
|
||||
|
||||
#include "cimgui.h"
|
||||
|
||||
void overlayGetImGuiRect(struct Rect * rect)
|
||||
{
|
||||
ImVec2 size;
|
||||
ImVec2 pos;
|
||||
|
||||
igGetWindowPos(&pos);
|
||||
igGetWindowSize(&size);
|
||||
|
||||
rect->x = pos.x;
|
||||
rect->y = pos.y;
|
||||
rect->w = size.x;
|
||||
rect->h = size.y;
|
||||
}
|
Loading…
Reference in New Issue
Block a user