Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Hexile

Pages: [1] 2
1
Help requests / Re: Trouble syncing scrollbar and knob widgets
« on: 20 August 2016, 18:47:49 »
Fixed. I overlooked the callback's lower half when testing before

2
Help requests / Re: Trouble syncing scrollbar and knob widgets
« on: 20 August 2016, 18:18:40 »
I left this project for a while but decided to do some cleaning to get around some oddities and visual bugs, there is one thing that i can't seem to get working now: flipping the visual range of scroll bars.
Theoretically 255-value should do the trick but the application gets stuck in a loop. "value" can only range from 0 to 255 anyway.

Initialization:
Code: [Select]
#define SCROLLBAR_BTN_SIZE 12 // makes the scrollbar visible

tgui::Scrollbar::Ptr scrollbar1(gui);
scrollbar1->load(THEME_CONFIG_FILE);
scrollbar1->setVerticalScroll(true);
scrollbar1->setPosition(20, 20);
scrollbar1->setSize(18, 256);
scrollbar1->setMaximum(255 + SCROLLBAR_BTN_SIZE);
scrollbar1->setLowValue(SCROLLBAR_BTN_SIZE);

tgui::Knob::Ptr knob1(gui);
knob1->load("data/widgets/Knob/Knob.conf");
knob1->setPosition(55, 235);
knob1->setSize(40, 40);
knob1->setStartRotation(127 + 90);
knob1->setEndRotation(-128 + 90);
knob1->setMinimum(0);
knob1->setMaximum(255);

//...  ... knob/slider 8

Callback handling:
Code: [Select]
// Knobs
case Knob_CALLBACK_ID + 1:
{
value = knob1->getValue();

if (invert_Knob_SYNC == true) scrollbar1->setValue(value); // Do something here ??
else scrollbar1->setValue(value); // default
_itoa_s(value, valText, 10);
reverse(valText);
char lvalue[7];
lvalue[0] = valText[0];
lvalue[1] = '\n';
lvalue[2] = valText[1];
lvalue[3] = '\n';
lvalue[4] = valText[2];
lvalue[5] = '\0';
val1->setText(lvalue);

std::cout << value << '\t' << "knob1" << '\t';

break;
}
//...  ... case 8
case Knob_CALLBACK_ID + 9:
{
invert_Knob_SYNC = !invert_Knob_SYNC;
break;
}
case KnobScroll_CALLBACK_ID + 1:
{
value = scrollbar1->getValue();

if (invert_Knob_SYNC == true) knob1->setValue(value); // Do something here as well ???
else knob1->setValue(value); // default
break;
}
//...  ... case 8

Any suggestions on how to accomplish this?

3
Installation help / Re: Project migration issue on VS2015
« on: 20 August 2016, 03:24:28 »
Aha. The migration caused some issues with the solution, so i created a new solution, with tgui 0.6.10 and pasted my code in there and it works fine now

4
Installation help / Project migration issue on VS2015
« on: 19 August 2016, 21:22:09 »
Ok, i'm not sure what's going on here.

I went from VS2013, TGUI 0.6.9 and SFML 2.3.2 to VS2015, TGUI 0.7.1 and SFML 2.4.0 between 2 different computers with very different configurations.

Anyhow, there is a really odd issue that prevents me from compiling my project:
Code: [Select]
sf::RenderWindow window(sf::VideoMode(960, 600), "RexKeyPad");
tgui::Gui gui(window);

if (gui.setGlobalFont("data/DroidSansMono.ttf") == false)
return 1;

Quote
Severity   Code   Description   Project   File   Line   Suppression State
Error (active)      class "tgui::Gui" has no member "setGlobalFont"   RexKeyPad   c:\DEV\RexKeyPad\RexKeyPad\Main.cpp   107   

Any TGUI code beyond the IF above fails with various errors which wouldn't normally exist.

I have triple checked all sorts of path, include, lib etc configurations but can't find the cause. Any help would be appreciated

5
Help requests / Re: Trouble syncing scrollbar and knob widgets
« on: 19 December 2015, 23:15:58 »
Yea, that works. All is good now. :)

6
Help requests / Re: Trouble syncing scrollbar and knob widgets
« on: 19 December 2015, 22:41:03 »
\/

7
Help requests / Re: Trouble syncing scrollbar and knob widgets
« on: 19 December 2015, 21:41:03 »
it's pretty long, added it as attachment.

8
Help requests / Re: Trouble syncing scrollbar and knob widgets
« on: 19 December 2015, 17:26:43 »
I see. But it only works towards maximum, i would have expected it to work both ways

9
Help requests / Re: Trouble syncing scrollbar and knob widgets
« on: 19 December 2015, 16:48:13 »
Ah, found a reliable way to trigger it; It happens when clicking on the area not specified, i.e:



Most of the time it sets the knob to near/at maximum level

10
Help requests / Re: Trouble syncing scrollbar and knob widgets
« on: 19 December 2015, 16:10:27 »
Code: [Select]
tgui::Knob::Ptr knob1(gui);
knob1->load("data/widgets/Knob/Knob.conf");
knob1->setPosition(55, 235);
knob1->setSize(40, 40);
knob1->setStartRotation(127);
knob1->setValue(0);
knob1->setEndRotation(-128);
knob1->setMinimum(0);
knob1->setMaximum(127);

11
Help requests / Re: Trouble syncing scrollbar and knob widgets
« on: 19 December 2015, 04:24:09 »
I see.

There is a minor glitch with the knobs; the first time they are clicked, they jump to what seems to be a random point above half of the maximum value set.

12
Help requests / Re: Trouble syncing scrollbar and knob widgets
« on: 14 December 2015, 11:09:03 »
Fixed. a quick question though: is it possible to change the color of a widget like SFML can do on sprites?

I.e: sprite.setColor(sf::Color(0, 255, 0)); // green

13
Help requests / Trouble syncing scrollbar and knob widgets
« on: 14 December 2015, 02:31:30 »
I have 8 knobs and 8 scrollbars in my project but i keep running into issues when i try to sync them.

Working:
Default/Inverted Mode: Knob operates Scrollbar
Inverted Mode: Knob operates Scrollbar
Not working:
Default Mode: Scrollbar operates Knob


How can i correctly sync changes between them?


Interesting bits of code:

Code: [Select]
const int vertical_control_separator = 100;

tgui::Scrollbar::Ptr scrollbar(gui);
scrollbar->load(THEME_CONFIG_FILE);
scrollbar->setVerticalScroll(true);
scrollbar->setPosition(20, 20);
scrollbar->setSize(18, 256);
scrollbar->setMaximum(127);
scrollbar->setLowValue(8);

tgui::Knob::Ptr knob(gui);
knob->load("data/widgets/Knob/Knob.conf");
knob->setPosition(55, 235);
knob->setSize(40, 40);
knob->setStartRotation(127);
knob->setValue(0);
knob->setEndRotation(-128);

Code: [Select]
/* Callback handling*/
#define Knob_CALLBACK_ID 10
#define KnobScroll_CALLBACK_ID 20

bool invert_Knob_SYNC=false;

knob->bindCallback(tgui::Knob::ValueChanged);
knob->setCallbackId(Knob_CALLBACK_ID +1);

syncbox->bindCallback(tgui::Checkbox::Checked);
syncbox->bindCallback(tgui::Checkbox::Unchecked);
syncbox->setCallbackId(Knob_CALLBACK_ID + 9);

scrollbar->bindCallback(tgui::Scrollbar::ValueChanged);
scrollbar->setCallbackId(KnobScroll_CALLBACK_ID + 1);

Code: [Select]
int value;

switch(callback.id)
{
// Knobs
case Knob_CALLBACK_ID + 1:
{
value=knob->getValue();

if (invert_Knob_SYNC == true) scrollbar->setValue(value / 3); // works but sync is flipped
else scrollbar->setValue((128 - 8) - (value / 3)); // default ( offset fixed)
break;
}
Code: [Select]
case Knob_CALLBACK_ID + 9:
{
invert_Knob_SYNC = !invert_Knob_SYNC;
break;
}
Code: [Select]
case KnobScroll_CALLBACK_ID + 1:
{
value = scrollbar->getValue();

if (invert_Knob_SYNC == true) knob8->setValue(value * 3); // works but sync is flipped
//else knob->setValue(? ); // broken
break;
}

14
Help requests / Re: instant runtime hanging with LoadFromFile example
« on: 13 December 2015, 18:16:53 »
Oh. i thought what was a minimum version required. I have previously been using borland devcpp with a build setup pointing to the vs12/14 compiler so switching IDE takes some time...

15
Help requests / Re: instant runtime hanging with LoadFromFile example
« on: 13 December 2015, 18:04:32 »
Replaced SFML with the VC12 version, it just changes the problem slightly:
Code: [Select]
Unhandled exception at 0x0FC3FA96 (sfml-system-d-2.dll) in tgui-test.exe: 0xC0000005: Access violation reading location 0xCCCCCCD8.
Exception thrown at 0x0FC3FA96 (sfml-system-d-2.dll) in tgui-test.exe: 0xC0000005: Access violation reading location 0xCCCCCCD8.

Pages: [1] 2