|
Re: What are you working on?
[Re: 20BN]
#478196
09/18/19 13:00
09/18/19 13:00
|
Joined: Jul 2007
Posts: 619 Turkey, Izmir
Emre
User
|
User
Joined: Jul 2007
Posts: 619
Turkey, Izmir
|
@jenGs @Emre
Can you provide some examples of lite-c scripts for IMGUI? I want to learn how they are created. Checkbox, Listbox, Slider and set Child / Group, etc. Yes of course. Here is little example. it' not include all code but i'm sure it will help.
#include <acknex.h>
#include <default.c>
#define PRAGMA_PATH "%EXE_DIR%\templates\images";
#define PRAGMA_PATH "%EXE_DIR%\samples";
#define PRAGMA_PATH "imgui_header"
#include "imgui.h"
//sky_color.red for slider
int skyred=128;
int skygreen=128;
int skyblue=128;
int draw_test=0;
void synchronize_startup()
{
while(1)
{
if(draw_test==1)
{
draw_text("Chekbox TRUE",10,10,COLOR_RED);
}
sky_color.red=skyred;
sky_color.green=skygreen;
sky_color.blue=skyblue;
wait(1);
}
}
BMAP* b1="rock.tga";
BMAP* b2="sand.tga";
BMAP* b3="detail.tga";
BMAP* b4="display.pcx";
// show-hide handle for widnwow 1
static BOOL showWindow1 = true;
void window_func()
{
if(showWindow1)//for show-hide window1
{
#ifndef create_first_window
#define create_first_window
//set position and size
imgui_set_next_window_pos(1, 50, ImGuiCond_Once);
imgui_set_next_window_size(700, 400, ImGuiCond_Once);
//create window
imgui_begin("Pictures Window", &showWindow1, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse );
imgui_image(b1);//add image
imgui_same_line();//add next image to same line
imgui_image(b2);//add image
imgui_image(b3);//add image (not same line)
//add text
imgui_text("Click to picture below");
//add button image
if(imgui_button_img("Button Image",b4, 200, 200))
{
//event
printf("Test Message");
}
imgui_end();
}
#endif
#ifndef create_second_window
#define create_second_window
//set position and size
imgui_set_next_window_pos(screen_size.x-400, 50, ImGuiCond_Once);
imgui_set_next_window_size(400, 600, ImGuiCond_Once);
//create
imgui_begin("Test Window", NULL, NULL);
//add slider
imgui_slider_int("Sky Red", skyred, 0, 255);
imgui_slider_int("Sky Green", skygreen, 0, 255);
imgui_slider_int("Sky Blue", skyblue, 0, 255);
//add button
if(imgui_button("Hide/Show Pictures window"))
{
//button event
if(showWindow1==true)
{
showWindow1=false;
return;
}
if(showWindow1==false)
{
showWindow1=true;
}
}
imgui_checkbox("Test",&draw_test);
imgui_end();
#endif
}
void loop()
{
imgui_start_imode();
window_func();
imgui_end_imode();
}
void main()
{
mouse_sync = 0;
mouse_pointer = 2;
mouse_mode = 4;
video_switch(10, 32, 2);
wait(1);
level_load("");
bmap_preload(b1);
bmap_preload(b2);
bmap_preload(b3);
bmap_preload(b4);
imgui_init(0);
on_d3d_lost = imgui_reset;
on_scanmessage = custom_scan_message;
on_frame = loop;
}
BTW; i rebuild dll with "Multi-threaded (/MT)" as 20BN mention it. Also build it with release configuration, not debug configuration. Test it another pc and it works without problem!
|
|
|
Re: What are you working on?
[Re: jumpman]
#478201
09/18/19 13:45
09/18/19 13:45
|
Joined: Feb 2007
Posts: 34 LUTZ
karmacomposer
Newbie
|
Newbie
Joined: Feb 2007
Posts: 34
LUTZ
|
Jumpman, Absolutely beautiful - loved the video walkthrough as well.
Mike
YOU DREAM IT - WE CREATE IT! For custom scoring, audio, video and more for your games, visit www.rubidex.net
|
|
|
|