MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / RenderButton

Function RenderButton

Descent3/TelcomEffectsRender.cpp:888–1024  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

886#define FLASH_SWITCH 1.0f
887extern tceffect TCEffects[MAX_TCEFFECTS];
888void RenderButton(tceffect *tce, float frametime, int xoff, int yoff, bool ok_to_render) {
889 if (!ok_to_render)
890 return;
891 ASSERT(tce->type == EFX_BUTTON);
892 tTCEvent evt;
893 bool time_to_flash = false;
894 bool glow = false;
895 while (PopEvent(tce, &evt)) {
896 switch (evt.id) {
897 case TEVT_GAINFOCUS: {
898 int num = tce - TCEffects;
899 // mprintf(0,"Button: Recv'd GAIN FOCUS Event (%d)\n",num);
900 } break;
901 case TEVT_LOSTFOCUS: {
902 int num = tce - TCEffects;
903 // mprintf(0,"Button: Recv'd LOST FOCUS Event (%d)\n",num);
904 } break;
905 case TEVT_MOUSEOVER: {
906 if (tce->flags & OBF_GLOW) {
907 if (tce->flags & OBF_MOUSEOVERFOCUS) {
908 // for effects with this flag set, only glow if we have focus
909 if (tce->tab_stop && tce->has_focus) {
910 time_to_flash = true;
911 glow = true;
912 }
913 } else {
914 time_to_flash = true;
915 glow = true;
916 }
917 }
918 } break;
919 case TEVT_MOUSEENTER: {
920 if (tce->flags & OBF_MOUSEOVERFOCUS) {
921 // check to see if we have focus, if not, and we are a tab, set focus
922 if (tce->tab_stop && !tce->has_focus) {
923 // set the focus on us!
924 TelComSetFocusOnEffect(tce - TCEffects);
925 }
926 }
927 } break;
928 case TEVT_MOUSECLICK:
929 case TEVT_MOUSEDOWN:
930 case TEVT_MOUSEUP: {
931 // send out the event to the appropriate system/effect
932 switch (tce->buttoninfo.button_type) {
933 case BUTT_UPARROW: {
934 // mprintf(0,"Button: Telling Text to Scroll Up\n");
935 int efxnum = GetEfxNumFromID(tce->buttoninfo.parent, tce->screen);
936 if (efxnum != -1) {
937 SendEventToEffect(efxnum, TEVT_SCROLLUP);
938 }
939 } break;
940 case BUTT_DOWNARROW: {
941 // mprintf(0,"Button: Telling Text to Scroll Down\n");
942 int efxnum = GetEfxNumFromID(tce->buttoninfo.parent, tce->screen);
943 if (efxnum != -1) {
944 SendEventToEffect(efxnum, TEVT_SCROLLDOWN);
945 }

Callers 1

RenderEffectFunction · 0.85

Calls 6

PopEventFunction · 0.85
TelComSetFocusOnEffectFunction · 0.85
GetEfxNumFromIDFunction · 0.85
SendEventToEffectFunction · 0.85
TelComSendEventFunction · 0.85
BltBmpToScreenFunction · 0.85

Tested by

no test coverage detected