Merge pull request #12 from benlankamp/BL/SDL-UserInput-plus-hotfixes

Input fixes for ImGui in map editor
This commit is contained in:
jmarshall23
2020-06-21 14:58:43 -07:00
committed by GitHub
9 changed files with 51 additions and 76 deletions
+8 -29
View File
@@ -67,7 +67,6 @@ DynamicVectorClass<EgoClass *> EgoList;
** Names of slideshow pictures to play behind the text
*/
char SlideNames[NUM_SLIDES][13]={
"aftr_hi.pcx",
"aly1.pcx",
"apc_hi.pcx",
@@ -87,29 +86,6 @@ char SlideNames[NUM_SLIDES][13]={
"tent.pcx"
};
/*
** Names of low res slideshow pictures to play behind the text
*/
char LoresSlideNames[NUM_SLIDES][13]={
"malo0107.cps",
"mig_lo.cps",
"mtfactlo.cps",
"needl-lo.cps",
"sov2-lo.cps",
"spy-lo.cps",
"staln-lo.cps",
"tent-lo.cps",
"aftr_lo.cps",
"aly1-lo.cps",
"apc_lo.cps",
"aplo0049.cps",
"bnlo0020.cps",
"dclo0040.cps",
"frlo0166.cps",
"lab-lo.cps",
"lands-lo.cps"
};
/*
** Array of all the palettes required for the slides
*/
@@ -293,7 +269,9 @@ void EgoClass::Wipe (GraphicBufferClass *background)
}
}
background->Blit(*LogicPage, x-1, YPos, x-1, YPos, width+2, 7 * RESFACTOR +1, false);
GL_FillRect( TBLACK, x - 1, YPos, width + 2, 7 * RESFACTOR + 1 );
//background->Blit(*LogicPage, x-1, YPos, x-1, YPos, width+2, 7 * RESFACTOR +1, false);
}
@@ -744,9 +722,9 @@ void Show_Who_Was_Responsible (void)
*/
for (index = 0 ; index < NUM_SLIDES ; index++)
{
SlideBuffers[index] = new GraphicBufferClass;
SlideBuffers[index]->Init (SeenBuff.Get_Width(), SeenBuff.Get_Height(), NULL , 0 , (GBC_Enum)0);
Load_Title_Screen( &SlideNames[index][0], SlideBuffers[index], (unsigned char*) &SlidePals[index][0] );
//SlideBuffers[index] = new GraphicBufferClass;
//SlideBuffers[index]->Init (SeenBuff.Get_Width(), SeenBuff.Get_Height(), NULL , 0 , (GBC_Enum)0);
//Load_Title_Screen( &SlideNames[index][0], SlideBuffers[index], (unsigned char*) &SlidePals[index][0] );
}
/*
@@ -812,7 +790,7 @@ void Show_Who_Was_Responsible (void)
/*
** Do the slideshow background.
*/
Slide_Show (slide_number, picture_frame);
//Slide_Show (slide_number, picture_frame);
/*
** Scroll the text. If any text goes off the top then delete that object.
@@ -855,6 +833,7 @@ void Show_Who_Was_Responsible (void)
*/
HidPage.Blit(SeenBuff, 0, 8 * RESFACTOR, 0, 8*RESFACTOR, SeenBuff.Get_Width(), SeenBuff.Get_Height() - 16* RESFACTOR, false);
/*
** If user hits escape then break.
*/
+4 -29
View File
@@ -243,31 +243,8 @@ const char* XlatNames[] = {
#endif
#ifndef WIN32 //VG
#define OPTION_WIDTH 236
#ifdef FIXIT_CSII // checked - ajw 9/28/98
#error Can never again build without WIN32 defined.
#define OPTION_HEIGHT 162
#else
#define OPTION_HEIGHT 162
#endif
#define OPTION_X ((320 - OPTION_WIDTH) / 2)
#define OPTION_Y (200 - OPTION_HEIGHT) / 2
#else
#define OPTION_WIDTH 560
#ifdef FIXIT_CSII // checked - ajw 9/28/98
#define OPTION_HEIGHT 332
#else
#define OPTION_HEIGHT 300
#endif
#define OPTION_X ((640 - OPTION_WIDTH) / 2)
#define OPTION_Y (400 - OPTION_HEIGHT) / 2
#endif
#define OPTION_WIDTH 560
#define OPTION_HEIGHT 332
struct EObjectClass
{
@@ -355,11 +332,7 @@ void EListClass::Draw_Entry(int index, int x, int y, int width, int selected)
}
}
#ifndef WIN32
Conquer_Clip_Text_Print(buffer, x, y, scheme, TBLACK, flags & ~(TPF_CENTER), width, Tabs);
#else
Conquer_Clip_Text_Print(buffer, x + 100, y, scheme, TBLACK, flags & ~(TPF_CENTER), width, Tabs);
#endif
}
#ifdef FIXIT_VERSION_3
@@ -369,6 +342,8 @@ bool Expansion_Dialog(void)
#endif
{
GadgetClass * buttons = NULL;
int OPTION_X = (SeenBuff.Get_Width() - OPTION_WIDTH) / 2;
int OPTION_Y = (SeenBuff.Get_Height() - OPTION_HEIGHT) / 2;
#ifndef WIN32
TextButtonClass ok(200, TXT_OK, TPF_BUTTON, OPTION_X+40, OPTION_Y+OPTION_HEIGHT-15);
+9 -2
View File
@@ -655,6 +655,8 @@ int MapEditClass::Pick_Scenario(char const * caption, int & scen_nump, ScenarioP
g_globalKeyNumType = KN_NONE;
g_globalKeyFlags = 0;
UserInput.Process_Input();
Device_Present();
}
Imgui_Dialog_Function = nullptr;
@@ -1122,6 +1124,8 @@ int MapEditClass::Size_Map(int x, int y, int w, int h)
g_globalKeyFlags = 0;
UserInput.Process_Input();
Device_Present();
// display = REDRAW_NONE;
@@ -1958,9 +1962,10 @@ int MapEditClass::Scenario_Dialog(void)
*/
KeyNumType input = KN_NONE; //commands->Input();
g_globalKeyNumType = KN_NONE;
//g_globalKeyNumType = KN_NONE;
g_globalKeyFlags = 0;
UserInput.Process_Input();
UserInput.Process_Input(input);
/*
** Process input
@@ -2554,6 +2559,8 @@ int MapEditClass::Select_Trigger(void)
g_globalKeyFlags = 0;
UserInput.Process_Input();
Device_Present();
/*
** Get user input
*/
+5 -1
View File
@@ -1589,7 +1589,7 @@ void MapEditClass::Main_Menu(void)
g_globalKeyFlags = 0;
UserInput.Process_Input();
Call_Back();
Device_Present();
Show_Mouse();
@@ -1786,8 +1786,12 @@ void MapEditClass::AI_Menu(void)
*/
Call_Back();
g_globalKeyNumType = KN_NONE;
g_globalKeyFlags = 0;
UserInput.Process_Input();
Device_Present();
/*
** Invoke menu
*/
+6
View File
@@ -330,6 +330,12 @@ int MapEditClass::Select_Team(char const * )
/*
** Get user input
*/
g_globalKeyNumType = KN_NONE;
g_globalKeyFlags = 0;
UserInput.Process_Input();
//Device_Present();
KeyNumType input = commands->Input();
/*
+8 -7
View File
@@ -245,11 +245,7 @@ int Check_Menu(int menu, char const * text[], char *, long field, int index, Key
key = 0;
UnknownKey = 0;
if (Keyboard->Check()) {
#ifdef WIN32
key = (Keyboard->Get() & ~(WWKEY_SHIFT_BIT | WWKEY_ALT_BIT | WWKEY_CTRL_BIT)); /* mask off all but release bit */
#else
key = (Keyboard->Get() & 0x08FF); /* mask off all but release bit */
#endif
}
}
else {
@@ -441,18 +437,23 @@ int Do_Menu(char const ** strings, bool )
Keyboard->Clear();
selection = -1;
UnknownKey = 0;
// AI options main selection loop
while (selection == -1) {
// jmarshall
Call_Back();
g_globalKeyNumType = KN_NONE;
g_globalKeyFlags = 0;
UserInput.Process_Input();
Call_Back();
Device_Present();
Show_Mouse(true);
selection = Check_Menu(0, strings, NULL, 0xFFL, 0, (KeyNumType)g_globalKeyFlags);
if (UnknownKey != 0 || UnknownKey == KN_ESC || UnknownKey==KN_LMOUSE || UnknownKey==KN_RMOUSE) break;
if ( UnknownKey != 0 || UnknownKey == KN_ESC || UnknownKey==KN_LMOUSE || UnknownKey==KN_RMOUSE) break;
}
Keyboard->Clear();
Hide_Mouse();
+8 -6
View File
@@ -666,10 +666,10 @@ oh_dear_its_a_label:
...................... Refresh display if needed ......................
*/
{
if (housebtn.IsDropped) {
housebtn.Collapse();
display = REDRAW_BACKGROUND;
}
//if (housebtn.IsDropped) {
//housebtn.Collapse();
//display = REDRAW_BACKGROUND;
//}
Hide_Mouse();
/*
@@ -775,7 +775,7 @@ oh_dear_its_a_label:
.......................... Redraw buttons ..........................
*/
{
commands->Flag_List_To_Redraw();
//commands->Flag_List_To_Redraw();
commands->Draw_All();
}
@@ -788,12 +788,14 @@ oh_dear_its_a_label:
*/
messages_have_focus = Session.Messages.Has_Edit_Focus();
bool droplist_is_dropped = housebtn.IsDropped;
input = commands->Input();
/*
........................ Invoke game callback .........................
*/
Call_Back();
//Call_Back();
Device_Present();
Load_Title_Page(true);
+2 -2
View File
@@ -477,8 +477,8 @@ int Fetch_Difficulty(void)
{
int const w = 250 * RESFACTOR;
int const h = 80 * RESFACTOR;
int const x = ((320 * RESFACTOR)/2) - w/2;
int const y = ((200 * RESFACTOR)/2) - h/2;
int const x = ( SeenBuff.Get_Width() - w ) / 2;
int const y = ( SeenBuff.Get_Height() - h ) / 2;
int const bwidth = 30 * RESFACTOR;
/*
+1
View File
@@ -702,6 +702,7 @@ void Create_Main_Window ( HANDLE instance , int command_show , int width , int h
SDL_Init(SDL_INIT_VIDEO);
game_window = SDL_CreateWindow(WINDOW_NAME, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL);
game_context = SDL_GL_CreateContext(game_window);
SDL_GL_SetSwapInterval(0);
SDL_SysWMinfo wmInfo;
SDL_VERSION(&wmInfo.version);