Problem with WB3D_Spinner?

Blitz3D Forums/Blitz3D Programming/Problem with WB3D_Spinner?

Guy Fawkes(Posted 2012) [#1]
Hi all. Can someone please tell me why I can't get these spinners to go up by .01 or down by .01? I need it so that I can go up or down an entity's X,Y,Z position.


Here's the code:


WB3DStyles.bb:





Spinners.bb:





Thanks to all that help! :)

Last edited 2012


Yasha(Posted 2012) [#2]
I won't attempt to answer this right now, because I don't have enough familiarity with WB3D to know what to look for (and... I can't see anything that obviously looks like it's updating a spinner in that code). However...

I would strongly recommend that if you want to make a Windows GUI app, you not use Blitz3D. The style of programming forced on you by certain antifeatures of the Blitz language makes it impossible to program a GUI in an idiomatic way (instead you have to do that WaitEvent nonsense), so nothing you learn from this will be of any value for general Windows or GUI programming. (If WB3D_WaitEvent works the way I think it does, it will also interfere with 3D scenes updating properly.)

If you want your app to be primarily 3D, feel free to use B3D but design the 3D content first, and tack a GUI on top of more generic inputs using as thin a layer as possible so that it doesn't affect your program's logic.

If the 3D is just a helper for a primarily GUI app, B3D is definitely the wrong tool for the job, and you should use something else.


Guy Fawkes(Posted 2012) [#3]
Im not giving up.


Yasha(Posted 2012) [#4]
Well, actually you are.

When there is no merit in continuing a course of action, and you insist on following it anyway for what appears to be no reason, then yes, you have given up on succeeding in favour of... I have no idea what. Certainly not virtue. Whoever taught you not to give up even when you're doing it wrong did you a great disservice.


Guy Fawkes(Posted 2012) [#5]
Regardless of ur smart alec remarks, I am NOT giving up :) Also, NICE PEOPLE ONLY, allowed in here. If ur not gonna be nice then please, have a nice day! And go somewhere else! Otherwise, stay here, and be nice :) Thank You! :)


Yasha(Posted 2012) [#6]
My comments were well-intentioned, thank you very much.

Now, consider carefully: why do you not want to "give up" on something you've just been told is fruitless, having little practical and zero educational value?

You aren't being persistent, or plucky: you're being stubborn and foolish and you don't even have a reason.

Fine, if you're determined to find ways to waste your own effort, do your own damn thing.


ando(Posted 2012) [#7]
.....

Last edited 2012


_PJ_(Posted 2012) [#8]
Yet again you've copied & pasted someone else's code and are now trying to make use of it without a clue how it works...

However, I'll provide some way towards the answer you want:

1) Restore the code functionality from the original which deals with event messages from the gadgets
2) Especially those for "Spinner " type gadgets

3) (This is the main part)
Either remember to set a coefficient to divide the spinner value by 100 or so...
OR
Ensure that the spinner's value is able to take a Float and that increment/decrements are in the order 0.1


Guy Fawkes(Posted 2012) [#9]
Yasha, please leave. u are not welcome here. Ur rudeness has taken its toll. Ando, Im TRYING to be nice, but they arent helping.

PJ, I have NOT copy and pasted this.. I made this myself. Stop ASSUMING i copied... -.-


Yasha(Posted 2012) [#10]
Yasha, please leave. u are not welcome here. Ur rudeness has taken its toll


When, precisely? The part where I tried to be helpful or the part where I tried to reason through why you repeatedly refuse to even read sensible advice? (You shouldn't be designing a Windows GUI app in B3D, it's a terrible idea!)

I was prepared - I am still prepared - to give you a lot of help, but your only response to anything that isn't a complete prepared copy-paste solution seems to be incoherent rage, exactly as it has been for the last two years (you really do never change, do you? Take heed ando, this is an ancient dance).

You don't have to take my advice - you don't even have to acknowledge it - but if you're going to accuse me of rudeness you could have the basic decency to actually read my comments and try to understand them first (perhaps by asking for clarification as to e.g. why I think idiomatic GUI programming is so hard in B3D).


Guy Fawkes(Posted 2012) [#11]
I will NOT put up with rudeness anymore. Yes, I am willing to listen to what u have to say. IF u are kind while saying it. Otherwise, u are a fly on the wall.


Ross C(Posted 2012) [#12]
Get a grip dude!. Yasha is a good guy to have on your side when it comes to helping with coding. Don't be rude to him. How do you know it's not his birthday today? Happy Birthday Yasha (if it's your birthday that is).


Guy Fawkes(Posted 2012) [#13]
Ross. Quit hijacking my threads. Either make ur own, or go away. IM not the one being rude to him at ALL. HES the one being rude to ME. It WAS my birthday 2 days ago.


Yasha(Posted 2012) [#14]
Sadly not my birthday, no.

I will forgo explaining in detail for the moment, but I believe the program should be redesigned (or, y'know, designed). How it should be redesigned depends on what it's supposed to be, because the different tools at our disposal are best used in different ways.

So, going back to the first question: is this a primarily 3D app with a thin GUI control layer over the top, or a primarily GUI app with a few 3D bits? Or does it make heavy but equal use of both? Or some other combination? The answer to this question will provide you with a starting point for best design.

I was actually working on not even one but two tools to ease designing this sort of thing in B3D! I should probably do some more on them, then I can recommend simple alternatives...

(Tip: If you don't want design help at this stage, just say "no, I am confident that the design of my application is adequate for my needs at the moment" or something that's a little more sensible and thought-through than "Nevar give up!", and foosh the Yasha-genie disappears again.)

Last edited 2012


Guy Fawkes(Posted 2012) [#15]
It's a Particle Editor for Particle Candy. I HATE the old one they made a long time ago. It's like a Level Editor for Particles


Yasha(Posted 2012) [#16]
I'm actually going to take a moment to commend your choice of project here. A particle editor is a great idea as a beginner's application project (kinda like pong would be as a beginner's game project): it's small, so it's within your ability to complete; it's clearly-defined, so you won't be subject to overdesign or feature-creep; and it's of practical value, so you can take pleasure in a tool you made with your own hands. Well done! You did learn something!

Now it looks like the main part of your project is actually the GUI section, since the mechanical problem is already solved and your main issue is that you don't like CandyStore's interface, right? (I actually really liked CandyStore, but w/e, each to their own.)

However, because this is such a clearly-defined small project, I would recommend that you leave the GUI for the moment and focus on the rest of it first (design the GUI on paper or a prototyping app if you like, but don't write the code yet).

Consider your application as a whole. As a particle editor, it has four main tasks it needs to fulfil:

-- maintain a model of the particle effect currently being edited
-- allow the user to apply changes to that particle effect model
-- display the current particle effect through Particle Candy
-- save the effect model to a file that can later be loaded by your main project (offhand I can't remember how Particle Candy loads effects... I assume there is some established method).

Each of these is really a separate task. Note that as yet, none of them say anything about the nature of the interface the user actually goes through to make changes.

So. The most fundamental of these is the effect model. This doesn't really need to be anything more complicated than a collection of variables, each representing one of the properties you want to be able to edit (note: this does not need to match up with Particle Candy's internal particle properties: this is about what properties you want a particle to have and to be able to adjust). You could use a bunch of globals for this, or better, and instance of a custom record type representing "an effect". So all the model is is a list of numbers describing the editable properties of your particle effect.

Everything revolves around the model (functionality of the app will be all about this set of properties, so settling on them is absolutely fundamental), so this should be what you design first. At this point I would recommend breaking away, designing a particle-model-module, and having it load a list of properties and display them onscreen as text/numbers, just to check that you can hold and modify the effect model as a thing in itself.

Once that's done, you should create a proper code interface for manipulating it. Create a function for each property that lets you either set or adjust it (set-to-new-value or add-this-to-existing-value), and rebuild your app to use these functions and these functions only to manipulate the model. The core of your application is now in place. (Still haven't looked at the GUI.)


...if this is making sense or sounding familiar so far, then you should be able to see where the rest of the design goes, and why the GUI shouldn't be providing a base architecture for the rest of your program. As long as each section can communicate with each other only though predefined channels: the main draw loop asks Particle Candy to read from the effect model and translate your useful-properties into Particle Candy-specific-properties, then draw them; the control section of the loop should take effect-control events and apply them to your effect-model-control functions; and only these effect-control-events should be generated by the GUI which has translated them out of actual GUI inputs.

It sounds like a lot of complication, but believe me when I say it's easier than trying to intermingle GUI code and functionality code.

More importantly, it means you can build in stages: after you have the text-on-screen version of your effect model, you can build the draw loop which uses Particle Candy to draw the particle effect without thinking about how the user will control this. Drawing then takes care of itself, and you can test the particle effect management by having text on screen showing you numbers, and having simple key presses generating effect control events.

Then, once you have the editor essentially working (i.e. able to edit particle effects and display them in action), you can create a GUI layer that doesn't really "do" anything, but instead simply generates effect-control events to pass on to the model, which will in turn be automatically picked up by the display engine. Because the GUI goes through this translated "channel", you can use it, not use it (and stick to keyboard), swap it out for another one, etc. without affecting your program's functionality.

This is a bit of a vague ramble that still doesn't address why I think B3D is a bad idea for GUI apps (it has to do with the absence of function pointers), but hopefully will be of at least some help, in splitting the painful GUI-code part of your program out of the bit that actually matters (we can get to the intricacies of GUI programming another time).


stayne(Posted 2012) [#17]
Holy help. You deserve a medal Yasha.


Guy Fawkes(Posted 2012) [#18]
Well, Particle Candy is easy to load. Its JUST the WB3D GUI spinner part I need help with. Because with THAT fixed, I can use THAT to implement ALL the functions needed to edit, save, etc... A Particle from Particle Candy :)


stayne(Posted 2012) [#19]
You're going to use a spinner to save?


Guy Fawkes(Posted 2012) [#20]
no. im going to use a spinner to change the particle's properties, such as emission, chaos, etc..


ando(Posted 2012) [#21]
.....

Last edited 2012


Zethrax(Posted 2012) [#22]
Unfortunately this forum doesn't support sending PMs.


ando(Posted 2012) [#23]
.....

Last edited 2012


H&K(Posted 2012) [#24]
How can they be contacted on the forum because I don't do emails.(yet) :)
Well do do emails, takes like 5 mins to set up


ando(Posted 2012) [#25]
.....

Last edited 2012


Guy Fawkes(Posted 2012) [#26]
Ok, so can someone please.. PLEASE... Tell me how I can get the spinner to work? >< As I said, if I can get THIS to work, then I pretty much have the whole program working...


ando(Posted 2012) [#27]
.....

Last edited 2012


Guy Fawkes(Posted 2012) [#28]
..............................


ando(Posted 2012) [#29]
I'll go and good luck ! :)

Last edited 2012


Guy Fawkes(Posted 2012) [#30]
Thanks Ando :)


Guy Fawkes(Posted 2012) [#31]
Can someone PLEASE help me get spinners working? Ugh... Im trying to be nice, but its getting hard again T_T


stayne(Posted 2012) [#32]
Done! A little oil did the trick.




Guy Fawkes(Posted 2012) [#33]
Stayne, u are NOT welcome here! Leave this thread and dont come back! If ur not going to be nice, then leave! Have a good day

Last edited 2012


stayne(Posted 2012) [#34]
You know what is sad, little fella? Search for the word "spinner" in this 3 year old post of yours.

http://blitzmax.com/Community/posts.php?topic=82225#926706


Guy Fawkes(Posted 2012) [#35]
HA! That was a particle media player. NOT a particle EDITOR. so therefore, it is NOT sad :)


Naughty Alien(Posted 2012) [#36]


Last edited 2012


Guy Fawkes(Posted 2012) [#37]
^ =D


Guy Fawkes(Posted 2012) [#38]
Can u guys PLEASE for the love of science... GET BACK ON TOPIC! O_O


Adam Novagen(Posted 2012) [#39]
This thread, like so many of its kin before, has devolved into a sorry, pointless mess.




Guy Fawkes(Posted 2012) [#40]
Adam, ur not welcome here. go hijack someone elses thread. STOP BEING RUDE PPL! Im SICK of ur rudeness. -.- U know who u r.

Now either be nice, or PLEASE leave. LAST time im gonna warn u.


Yasha(Posted 2012) [#41]
That was a particle media player. NOT a particle EDITOR. so therefore, it is NOT sad


I believe Naughty is trying to say that you should be seeing the common element between the player and the editor, and reusing your own spinner code, since you have apparently solved this problem before. A spinner's just a spinner, regardless of what it controls. The code should be almost identical (Yasha says without looking at it).


How can they be contacted on the forum because I don't do emails.(yet) :)


If you use the "Contact" tab at the top, you will be given a contact form that will send a message to the BRL staff (although if you "don't do email", they can't easily respond to you).


Guy Fawkes(Posted 2012) [#42]
Ok Yasha, I'll take a look


Kev(Posted 2012) [#43]



_PJ_(Posted 2012) [#44]

PJ, I have NOT copy and pasted this.. I made this myself. Stop ASSUMING i copied... -.-



Sorry, I didn't realise you were the same person as Kev, and that you created both WB3D and the example program that comes with it....


/sarcasm

Anyway I answered your question, but you seem to have chosen to ignore my suggestion. Similarly, you took offence to Yasha's great advice, and even ignored the point that stayne made where you have, indeed previously made a working use of WB3D spinners.

The problem is with your Update function.

Firstly, note that UNDECLARED LOCAL VARIABLES are always initialised to 0 within B3D. So your 'count' variable is fairly redundant.

Included with WB3D is a very useful HELP file which documents each command and its use. The following entry will be of use.

WB3D_GadgetItemText(
int gadget,
int index,
)



As you can also see in the help file, WB3D_SetGadgetText() takes the following parameters:

WB3D_SetGadgetText(
int gadget,
string newtext;
)




Note the parameter for the new value is a STRING.

You will need to clarify the events a little better. Since you have INCREMENT and DECREMENT 'buttons' on the Spinner, but have not identified them in the code.

Lastly, you may want to also associate the EDIT FIELD with the spinner value.