Page 1 of 1

Current Selection Function for game and editor?

Posted: Sat Mar 05, 2011 7:14 pm
by MadPumpkin
So I'm working on my level editor now that I'm back. I've come across a problem that has been itching my brain, I need your guys' help to scratch it. I came across this problem in the past and gave up with it and did something else. However, I've become a much better programmer with all of your help and other sources, and now realize one way that seems logical to go about it.

I need some sort of function that will return what objects are selected in my level editor, so that I can alter the desired object. When you click on an object it will load all of the "current object"-'s data and allow you to change it in the 'Objects' window. Now, previously I was a lot more like, (immature 13 year old talk) "Hey guys HAHAHA give me cod3s too make my program work for me HAHA since I don't know how!!". So in the long run I never actually solved my problem. SOO... Now... Maybe some feedback on this theory and SUGGESTIONS on better directions would be greatly appreciated.

Give each object class a boolean value that changes depending on if the object is selected. Depending on this value, preform tasks such as, show a collision box, add it to the group of editable objects, highlight it in someway to show that it's selected.

Any help would be great :D.

Pepper out.

Re: Current Selection Function for game and editor?

Posted: Sun Mar 06, 2011 11:56 am
by thejahooli
I'm not entirely sure on the implementation you are looking for, but couldn't you just have your objects inheriting from a base object class and then have a pointer (or vector of pointers for multiple selection) to a base object which you then assign to whatever object you select.

Re: Current Selection Function for game and editor?

Posted: Sun Mar 06, 2011 12:44 pm
by dandymcgee
Was there a question in there somewhere? I'm kinda confused as to what you're asking, it seems like your idea would work fine.

Re: Current Selection Function for game and editor?

Posted: Sun Mar 06, 2011 12:46 pm
by ParticleGames
Are you asking for advice on your idea? I think it's a good plan.

Re: Current Selection Function for game and editor?

Posted: Sun Mar 06, 2011 1:43 pm
by MadPumpkin
sorry I worded it terribly,I went ahead and bolded the part that I kind of was wondering about. The rest of it is just my idea of how to do it. If that's a good idea, I'll just implement that one till I think of something better. I like Ginto's idea though, which is what I'm doing right now but a tid bit different.

Re: Current Selection Function for game and editor?

Posted: Mon Mar 07, 2011 11:56 pm
by xiphirx
How about you make the whole editor a class, and store a pointer to a base object that is selected?

[SOLVED]Current Selection Function for game and editor?

Posted: Tue Mar 08, 2011 12:39 am
by MadPumpkin
xiphirx wrote:How about you make the whole editor a class, and store a pointer to a base object that is selected?
Actually I'm done implementing my way of doing it. It's a pointer to a base object. But instead I used a vector of objects so that you can select anywhere from 1-75 objects at a time. I have the cap as 75 even though I doubt you would ever need that many in this editor.

EDIT: Also good suggestion but that would be a pain in the ass because most of the editor is multiple windows and I already have it set up one way, even the OpenGL rendering window is separate.
PS, I like your avatar image, looks sweet.

Re: Current Selection Function for game and editor?

Posted: Tue Mar 08, 2011 8:54 am
by Falco Girgis
First of all, what are you even making your Editor with?

Frameworks like QT and wXWidgets have this built in. Is this a from-scratch Editor with nothing but a graphics API like SDL or OpenGL, or are you using a GUI framework?

Re: Current Selection Function for game and editor?

Posted: Wed Mar 09, 2011 6:39 pm
by MadPumpkin
GyroVorbis wrote:First of all, what are you even making your Editor with?

Frameworks like QT and wXWidgets have this built in. Is this a from-scratch Editor with nothing but a graphics API like SDL or OpenGL, or are you using a GUI framework?
It's using Windows API and GL/GLU