Basic render modes for Render_ui
This commit is contained in:
parent
0f4c0915d9
commit
c63dff45e4
@ -328,7 +328,7 @@ int report_ui(pixel *vid_buf, char *save_id);
|
|||||||
|
|
||||||
char *console_ui(pixel *vid_buf, char error[255],char console_more);
|
char *console_ui(pixel *vid_buf, char error[255],char console_more);
|
||||||
|
|
||||||
void render_ui(pixel *vid_buf);
|
void render_ui(pixel *vid_buf, int xcoord, int ycoord, int orientation);
|
||||||
|
|
||||||
void simulation_ui(pixel *vid_buf);
|
void simulation_ui(pixel *vid_buf);
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ float plasma_data_pos[] = {1.0f, 0.9f, 0.5f, 0.25, 0.0f};
|
|||||||
void init_display_modes()
|
void init_display_modes()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
display_modes = calloc(sizeof(unsigned int), 1);
|
display_modes = calloc(1, sizeof(unsigned int));
|
||||||
render_modes = calloc(sizeof(unsigned int), 2);
|
render_modes = calloc(2, sizeof(unsigned int));
|
||||||
|
|
||||||
display_modes[0] = 0;
|
display_modes[0] = 0;
|
||||||
render_modes[0] = RENDER_FIRE;
|
render_modes[0] = RENDER_FIRE;
|
||||||
@ -1846,6 +1846,10 @@ void render_parts(pixel *vid)
|
|||||||
pixel_mode |= PMODE_GLOW;
|
pixel_mode |= PMODE_GLOW;
|
||||||
if(pixel_mode & FIRE_BLEND && !(render_mode & FIRE_BLEND))
|
if(pixel_mode & FIRE_BLEND && !(render_mode & FIRE_BLEND))
|
||||||
pixel_mode |= PMODE_BLUR;
|
pixel_mode |= PMODE_BLUR;
|
||||||
|
if(pixel_mode & PMODE_BLUR && !(render_mode & PMODE_BLUR))
|
||||||
|
pixel_mode |= PMODE_FLAT;
|
||||||
|
if(pixel_mode & PMODE_GLOW && !(render_mode & PMODE_GLOW))
|
||||||
|
pixel_mode |= PMODE_FLAT;
|
||||||
|
|
||||||
pixel_mode &= render_mode;
|
pixel_mode &= render_mode;
|
||||||
|
|
||||||
|
104
src/interface.c
104
src/interface.c
@ -24,6 +24,7 @@
|
|||||||
#ifdef PYCONSOLE
|
#ifdef PYCONSOLE
|
||||||
#include <pythonconsole.h>
|
#include <pythonconsole.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <powdergraphics.h>
|
||||||
|
|
||||||
SDLMod sdl_mod;
|
SDLMod sdl_mod;
|
||||||
int sdl_key, sdl_rkey, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0;
|
int sdl_key, sdl_rkey, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0;
|
||||||
@ -6043,8 +6044,109 @@ openfin:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void render_ui(pixel * vid_buf)
|
void render_ui(pixel * vid_buf, int xcoord, int ycoord, int orientation)
|
||||||
{
|
{
|
||||||
|
int i, j, count;
|
||||||
|
int xsize;
|
||||||
|
int ysize;
|
||||||
|
int yoffset;
|
||||||
|
int xoffset;
|
||||||
|
int b, bq, mx, my;
|
||||||
|
ui_checkbox *cb;
|
||||||
|
int optioncount = 5;
|
||||||
|
int options[] = {RENDER_EFFE, RENDER_GLOW, RENDER_FIRE, RENDER_BLUR, RENDER_BASC};
|
||||||
|
int optionicons[] = {0xCC, 0xC3, 0x9B, 0xC4, 0xD1};
|
||||||
|
|
||||||
|
yoffset = 16;
|
||||||
|
xoffset = 0;
|
||||||
|
|
||||||
|
xsize = 35;
|
||||||
|
ysize = optioncount * yoffset + 6;
|
||||||
|
|
||||||
|
ycoord -= ysize;
|
||||||
|
xcoord -= xsize;
|
||||||
|
|
||||||
|
cb = calloc(optioncount, sizeof(ui_checkbox));
|
||||||
|
for(i = 0; i < optioncount; i++)
|
||||||
|
{
|
||||||
|
cb[i].x = xcoord + (i * xoffset) + 5;
|
||||||
|
cb[i].y = ycoord + (i * yoffset) + 5;
|
||||||
|
cb[i].focus = 0;
|
||||||
|
cb[i].checked = 0;
|
||||||
|
j = 0;
|
||||||
|
while(render_modes[j])
|
||||||
|
{
|
||||||
|
if(render_modes[j] == options[i])
|
||||||
|
{
|
||||||
|
cb[i].checked = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!sdl_poll())
|
||||||
|
{
|
||||||
|
b = SDL_GetMouseState(&mx, &my);
|
||||||
|
if (!b)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!sdl_poll())
|
||||||
|
{
|
||||||
|
bq = b;
|
||||||
|
b = SDL_GetMouseState(&mx, &my);
|
||||||
|
mx /= sdl_scale;
|
||||||
|
my /= sdl_scale;
|
||||||
|
|
||||||
|
clearrect(vid_buf, xcoord-2, ycoord-2, xsize+4, ysize+4);
|
||||||
|
drawrect(vid_buf, xcoord, ycoord, xsize, ysize, 192, 192, 192, 255);
|
||||||
|
|
||||||
|
for(i = 0; i < optioncount; i++)
|
||||||
|
{
|
||||||
|
drawchar(vid_buf, cb[i].x + 16, cb[i].y+2, optionicons[i], 255, 255, 255, 255);
|
||||||
|
ui_checkbox_draw(vid_buf, &(cb[i]));
|
||||||
|
ui_checkbox_process(mx, my, b, bq, &(cb[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE));
|
||||||
|
|
||||||
|
if (sdl_key==SDLK_RETURN)
|
||||||
|
break;
|
||||||
|
if (sdl_key==SDLK_ESCAPE)
|
||||||
|
break;
|
||||||
|
if (b && !bq && (mx < xcoord || mx > xcoord+xsize || my < ycoord || my > ycoord+ysize))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
count = 1;
|
||||||
|
for(i = 0; i < optioncount; i++)
|
||||||
|
{
|
||||||
|
if(cb[i].checked)
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
free(render_modes);
|
||||||
|
render_mode = 0;
|
||||||
|
render_modes = calloc(count, sizeof(unsigned int));
|
||||||
|
count = 0;
|
||||||
|
for(i = 0; i < optioncount; i++)
|
||||||
|
{
|
||||||
|
if(cb[i].checked)
|
||||||
|
{
|
||||||
|
render_modes[count] = options[i];
|
||||||
|
render_mode |= options[i];
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(cb);
|
||||||
|
|
||||||
|
while (!sdl_poll())
|
||||||
|
{
|
||||||
|
b = SDL_GetMouseState(&mx, &my);
|
||||||
|
if (!b)
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void simulation_ui(pixel * vid_buf)
|
void simulation_ui(pixel * vid_buf)
|
||||||
|
12
src/main.c
12
src/main.c
@ -3162,17 +3162,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq)
|
if (x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq)
|
||||||
{
|
{
|
||||||
render_ui(vid_buf);
|
render_ui(vid_buf, XRES+BARSIZE-(510-491), YRES+(MENUSIZE-19), 3);
|
||||||
/*if (b & SDL_BUTTON_LMASK) {
|
|
||||||
set_cmode((cmode+1) % CM_COUNT);
|
|
||||||
}
|
|
||||||
if (b & SDL_BUTTON_RMASK) {
|
|
||||||
if ((cmode+(CM_COUNT-1)) % CM_COUNT == CM_LIFE) {
|
|
||||||
set_cmode(CM_GRAD);
|
|
||||||
} else {
|
|
||||||
set_cmode((cmode+(CM_COUNT-1)) % CM_COUNT);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
if (x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq)
|
if (x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq)
|
||||||
sys_pause = !sys_pause;
|
sys_pause = !sys_pause;
|
||||||
|
Reference in New Issue
Block a user