56 lines
952 B
C
56 lines
952 B
C
// Copyright © 2017 Project Golan, all rights reserved.
|
|
#include "i_gui.h"
|
|
|
|
#include "m_math.h"
|
|
|
|
// Static Functions ----------------------------------------------------------|
|
|
|
|
//
|
|
// I_GUI_auto
|
|
//
|
|
static void I_GUI_auto(I_gictx *g, I_objid id, int xl, int yl, int xu, int yu)
|
|
{
|
|
if(M_AABBPoint(xl, yl, xu, yu, g->cr.x, g->cr.y)) {
|
|
g->hot = id;
|
|
if(g->lc) g->act = id;
|
|
}
|
|
}
|
|
|
|
// Extern Functions ----------------------------------------------------------|
|
|
|
|
//
|
|
// I_GUI_Begin
|
|
//
|
|
void I_GUI_Begin(I_gictx *g)
|
|
{
|
|
g->hot = 0;
|
|
}
|
|
|
|
//
|
|
// I_GUI_End
|
|
//
|
|
void I_GUI_End(I_gictx *g)
|
|
{
|
|
// Set last left/right clicks.
|
|
g->llc = g->lc;
|
|
g->lrc = g->rc;
|
|
|
|
if(!g->lc && !g->rc)
|
|
g->act = 0;
|
|
}
|
|
|
|
//
|
|
// I_GUI_ButtonFId
|
|
//
|
|
bool I_GUI_ButtonFId(I_gictx *g, I_objid id, int x, int y, char const *text)
|
|
{
|
|
int const xl = x , yl = y;
|
|
int const xu = x + 90, yu = y + 30;
|
|
|
|
I_GUI_auto(g, id, xl, yl, xu, yu);
|
|
|
|
return false;
|
|
}
|
|
|
|
// EOF
|