2019-02-25 16:52:53 +00:00
/*
Copyright 2019 flyinghead
2021-04-08 08:38:26 +00:00
This file is part of Flycast .
2019-02-25 16:52:53 +00:00
2021-04-08 08:38:26 +00:00
Flycast is free software : you can redistribute it and / or modify
2019-02-25 16:52:53 +00:00
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 .
2021-04-08 08:38:26 +00:00
Flycast is distributed in the hope that it will be useful ,
2019-02-25 16:52:53 +00:00
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
2021-04-08 08:38:26 +00:00
along with Flycast . If not , see < https : //www.gnu.org/licenses/>.
2019-02-25 16:52:53 +00:00
*/
2020-03-28 16:58:01 +00:00
# pragma once
2019-02-25 16:52:53 +00:00
# include <string>
2019-10-05 09:50:14 +00:00
# include "types.h"
# include "imgui/imgui.h"
2021-03-01 09:13:40 +00:00
# include "imgui/imgui_internal.h"
2019-10-05 09:50:14 +00:00
# include "gles/imgui_impl_opengl3.h"
2019-11-29 18:28:22 +00:00
# include "vulkan/vulkan_context.h"
2019-12-25 12:09:54 +00:00
# include "gui.h"
2019-10-05 09:50:14 +00:00
2021-04-06 09:41:04 +00:00
extern int screen_width , screen_height ;
2019-02-25 16:52:53 +00:00
typedef void ( * StringCallback ) ( bool cancelled , std : : string selection ) ;
2021-04-06 09:41:04 +00:00
void select_file_popup ( const char * prompt , StringCallback callback ,
bool selectFile = false , const std : : string & extension = " " ) ;
2019-10-05 09:50:14 +00:00
2021-04-06 09:41:04 +00:00
static inline void ImGui_impl_RenderDrawData ( ImDrawData * draw_data )
2019-10-05 09:50:14 +00:00
{
# ifdef USE_VULKAN
2021-03-01 09:13:40 +00:00
if ( ! config : : RendererType . isOpenGL ( ) )
2021-04-08 08:38:26 +00:00
ImGui_ImplVulkan_RenderDrawData ( draw_data ) ;
2019-10-05 09:50:14 +00:00
else
# endif
2021-04-06 09:41:04 +00:00
ImGui_ImplOpenGL3_RenderDrawData ( draw_data ) ;
2019-10-05 09:50:14 +00:00
}
2020-11-25 12:54:27 +00:00
void ScrollWhenDraggingOnVoid ( const ImVec2 & delta , ImGuiMouseButton mouse_button ) ;
2021-02-01 11:38:29 +00:00
IMGUI_API const ImWchar * GetGlyphRangesChineseSimplifiedOfficial ( ) ; // Default + Half-Width + Japanese Hiragana/Katakana + set of 7800 CJK Unified Ideographs from General Standard Chinese Characters
2021-02-01 14:56:12 +00:00
IMGUI_API const ImWchar * GetGlyphRangesChineseTraditionalOfficial ( ) ; // Default + Half-Width + Japanese Hiragana/Katakana + set of 4700 CJK Unified Ideographs from Hong Kong's List of Graphemes of Commonly-Used Chinese Characters
2021-03-01 09:13:40 +00:00
// Helper to display a little (?) mark which shows a tooltip when hovered.
void ShowHelpMarker ( const char * desc ) ;
template < bool PerGameOption >
bool OptionCheckbox ( const char * name , config : : Option < bool , PerGameOption > & option , const char * help = nullptr ) ;
bool OptionSlider ( const char * name , config : : Option < int > & option , int min , int max , const char * help = nullptr ) ;
template < typename T >
bool OptionRadioButton ( const char * name , config : : Option < T > & option , T value , const char * help = nullptr ) ;
void OptionComboBox ( const char * name , config : : Option < int > & option , const char * values [ ] , int count ,
const char * help = nullptr ) ;
2021-04-06 09:41:04 +00:00
static inline void centerNextWindow ( )
{
ImGui : : SetNextWindowPos ( ImVec2 ( screen_width / 2.f , screen_height / 2.f ) , ImGuiCond_Always , ImVec2 ( 0.5f , 0.5f ) ) ;
}