AllIn1 Super Canvas Functionality [Additions at bottom]

Post here your demos and examples with the source files.
Forum rules
Always post the games with a screenshot.
The file must have the ged and data files (complete game source)
Use the forum attachment to post the files.
It is always better to use the first post to put the game files

AllIn1 Super Canvas Functionality [Additions at bottom]

Postby Hblade » Thu Apr 05, 2012 8:06 am

Check out the new AllIn1 System, it features an Earthbound styled window theme, and you can handle multiple windows in 1 canvas, as well as CLICKABLE CHOICES! you can also use hover effects. Please try this demo and see if you like it.

HOW TO USE:
The code is understandable, readable, and easy to use. to use this system, all you need to know is a few basic functions and how to call the array which I'll explain completely.

Functions:
createWindow(x, y, width, height, windowIndex); - draw a window on the screen. windowIndex is the window number, it's important that you don't have the same windowIndex, as you use these index's to place items / content into the window you created.

updateCanvas(); - updates the canvas, place before everything. prettymuch the same as erase(0, 0, 0, 1);

updateDraw(); - use to update the draw, if you want to change a window location, use this. Try to avoid placing this in draw_actor. Putting this in Draw Actor will cause the canvas to constantly update when it doesn't need to, and that would cause a slowdown. Use this if you have an event that brings a window up or something.

saveDraw(); - Use this at the end of the draw_actor area, as it will save every position of the windows and prevent updating it constantly.

sendTo(x_offset, y_offset, window_index); - This will allow you to place content into a window, by default the x and y offsets are already set to fit the window and not stick to it's border, however if you want to text to appear somewhere else on the window, you can use x offset and y offset. window_index is the window that you want to stick it to. (Example in ged file).

hotSpot(X, Y, Width, Height, Index); - This creates a "choice" section, a place where you can hover and click on the canvas. again, index is important, so try not to use the same index.

sendToHotspot(); - This will send text or an object to the hover/click area, aka hotspot.

doClick(hotspot_index); - This is essential for ENABLING the click effect, if you don't put this, then the hotspot will only have a hover effect. Place this in mousedown.

resetActive(); - Use this in mouseup, it resets the active variable that uses the click effect. otherwise, you'd stay clicked unless moved out of the area.

drawObject("actor_name", x_offset, y_offset, scale, windowindex, objectIndex); - This will draw an object on the canvas and stick it to a window of your choice. same offset goes as before. Set the scale to set the size of the drawing, and it uses decimals, so you can use 1.5 or .5 or something like that. windowIndex is the window you want to stick it to. objectIndex uses a variable called obScale, and its meant for storing the scale value if you ever needed to, so be sure to use a different index each time. :)





Calling the arrays:
To determine if a choice was clicked, you can use something like this
Code: Select all
//if First Choice was clicked
if(active[0])
{
    updateDraw();
    varx=25;
    vary=50;
}

//if Second Choice was clicked
if(active[1])
{
    updateDraw();
    varx=50;
    vary=50;
}

See how active[0] is in the if? That means, if the choice area with the index of 0 was clicked. Same with active[1], if the hotspot given the index of 1 was clicked, then it'll do some code.

if this is still confusing, I'll make it simple:
if active[0] means that when you click the choice created like this
Code: Select all
hotSpot(x, y, width, height, 0);

only with actual settings, then it'll do some code. Thats why the index is so important.

Anyways here's the stuff :D Enjoy! :)
winSys.zip
(36.01 KiB) Downloaded 387 times

Screenshot-Game Editor-2.png







SEE IT IN ACTION HERE :D
shoptest.zip
(67.23 KiB) Downloaded 375 times

Screenshot-Game Editor-3.png








Additions:
A namebox code. To use this, add the code under the screenshot anywhere in the global code.
Screenshot-Game Editor-5.png

Code: Select all
void NameBox(char *textactor)
{
    Actor *a=getclone(textactor);
    setpen(64, 25, 44, 0, a->height);
    moveto(a->xscreen, a->yscreen+(a->height/2));
    lineto(a->xscreen+a->width, a->yscreen+(a->height/2));
}


How to use:
NameBox("Name_display_Actor"); - Where ever the text actor is on screen, it will be followed by an equally-sized purplish box. you can stamp something to the top of a window to make a name appear using this.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: AllIn1 Super Canvas Functionality [Additions at bottom]

Postby lcl » Thu Apr 05, 2012 12:50 pm

This is quite interesting, great work! =D

I think you should continue this and make it easy to use so it handles things by itself.
You could make it do things automatically, you could, for example program the window opener function
to also have option to input text which would then be shown in the window and all sorts of things like that.
If you automatize them, I think more people will find use for this, because it would be easier. =D

This inspires me to do some things to the new version of my lclOS. :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: AllIn1 Super Canvas Functionality [Additions at bottom]

Postby SuperSonic » Thu Apr 05, 2012 1:27 pm

Hey, good job :wink:

I tried making something like this a long time ago but I failed XD

Anyways, +1 for succeeding where I failed :lol:
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: AllIn1 Super Canvas Functionality [Additions at bottom]

Postby Hblade » Thu Apr 05, 2012 2:24 pm

lol thanks guys, I ended up loosing track of time and before realizing it, it was like 3:00AM, then I continued till like 5:30AM.

LCL:
How would I do that? =P Maybe perhaps the BMP font thing, but I don't really know how to do that lol. also: I had only 5 hours of sleep xD So my brain isn't functioning at the speed as yesterday/last night xD

EDIT:
actually I do have an idea =)
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: AllIn1 Super Canvas Functionality [Additions at bottom]

Postby happyjustbecause » Thu Apr 05, 2012 6:04 pm

Hblade wrote:Check out the new AllIn1 System, it features an Earthbound styled window theme, and you can handle multiple windows in 1 canvas, as well as CLICKABLE CHOICES! you can also use hover effects. Please try this demo and see if you like it.

-------> HO <------ TO USE:
The code is understandable, readable, and easy to use. to use this system, all you need to know is a few basic functions and how to call the array which I'll explain completely.


Sorry to point out a spelling error, but just thought you might want to fix "HO TO USE" to HOW TO USE at the top of the post. I'm going to check out this download though, looks interesting.
For small creatures such as we the vastness is bearable only through love.
-Carl Sagan

Night Knight Development Thread
User avatar
happyjustbecause
 
Posts: 267
Joined: Tue Jul 26, 2011 3:10 pm
Location: Frazier Park, Ca
Score: 15 Give a positive score

Re: AllIn1 Super Canvas Functionality [Additions at bottom]

Postby Hblade » Thu Apr 05, 2012 6:12 pm

LOL thanks, fixed
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: AllIn1 Super Canvas Functionality [Additions at bottom]

Postby Hblade » Thu Apr 05, 2012 6:15 pm

Updated version screenshots:
Screenshot-Game Editor-7.png


Button text always centered, new instant text draw functionality
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: AllIn1 Super Canvas Functionality [Additions at bottom]

Postby lcl » Thu Apr 05, 2012 9:18 pm

Hblade wrote:LCL:
How would I do that? =P Maybe perhaps the BMP font thing, but I don't really know how to do that lol. also: I had only 5 hours of sleep xD So my brain isn't functioning at the speed as yesterday/last night xD

I played around with that BMP font loading but it turned out to be a little too slow. It's good if you don't have to do anything else at the same time AND if you want to be able to change the texts colors freely.

But what I found out as a much easier and better solution was to have all the ASCII characters as normal actors animations, so that you have 1 clone for 1 character. You just have to make it so that clone.0 has the animation of the first ASCII character, etc.
Note that you can do this all very easily, just use "Clone" - "Array" to clone the needed amount of those actors and then give them the font as animation. In the create actor event just do this:
Code: Select all
ChangeAnimationDirection("Event Actor", STOPPED);
animpos = cloneindex;

Then you can make a little function that you can input a string into and then the function goes through it, letter by letter and draws the needed character with draw_from()! Easy, isn't it? And you can then use this function in your window opening function and make it print the inputted string! =D

That's actually how the things are done in my new version of lclOS :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: AllIn1 Super Canvas Functionality [Additions at bottom]

Postby skydereign » Thu Apr 05, 2012 9:25 pm

lcl wrote:
Hblade wrote:LCL:
But what I found out as a much easier and better solution was to have all the ASCII characters as normal actors animations, so that you have 1 clone for 1 character. You just have to make it so that clone.0 has the animation of the first ASCII character, etc.
Note that you can do this all very easily, just use "Clone" - "Array" to clone the needed amount of those actors and then give them the font as animation. In the create actor event just do this:
Code: Select all
ChangeAnimationDirection("Event Actor", STOPPED);
animpos = cloneindex;

Then you can make a little function that you can input a string into and then the function goes through it, letter by letter and draws the needed character with draw_from()! Easy, isn't it? And you can then use this function in your window opening function and make it print the inputted string! =D

That's actually how the things are done in my new version of lclOS :D

I wouldn't recommend using clones for this, solely because all those clones aren't necessary. You can instead send an activation event to a single ascii actor, and in the activation event change its animpos to the ascii character you want. And then call draw_from. Since images from draw_from don't update, you only really need one actor, that you can change its rgb, and character it displays.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: AllIn1 Super Canvas Functionality [Additions at bottom]

Postby lcl » Thu Apr 05, 2012 9:35 pm

skydereign wrote:I wouldn't recommend using clones for this, solely because all those clones aren't necessary. You can instead send an activation event to a single ascii actor, and in the activation event change its animpos to the ascii character you want. And then call draw_from. Since images from draw_from don't update, you only really need one actor, that you can change its rgb, and character it displays.

Oh, why didn't I think of that before?

But what about having many texts on the screen at the same time and if they need to be updated all the time for moving them around?
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: AllIn1 Super Canvas Functionality [Additions at bottom]

Postby skydereign » Thu Apr 05, 2012 9:46 pm

lcl wrote:Oh, why didn't I think of that before?

But what about having many texts on the screen at the same time and if they need to be updated all the time for moving them around?

Moving them around? draw_from handles position for you, and all you are doing is changing the frame, and potentially the rgb (which isn't costly at all). But, I guess you are talking about the case where there is thousands of characters, in which it might be better to have the clones. Generally speaking neither method is slow, but as a rule of thumb I tend to keep the number of actors to a minimum. And I believe the point at which you begin to detect lag (really worst case) you would run into it from too many draw_from calls, rather than the number of changing animpos.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: AllIn1 Super Canvas Functionality [Additions at bottom]

Postby EvanAgain » Sun Jan 27, 2013 12:45 am

This is perfect for what I was trying to do as well, Thanks for making this.

Now just to look at the code and experiment with some things to make a different style of menu.

Awesome stuff!
EvanAgain
 
Posts: 51
Joined: Thu Jan 10, 2013 5:40 pm
Score: 4 Give a positive score

Re: AllIn1 Super Canvas Functionality [Additions at bottom]

Postby Hblade » Sun Jan 27, 2013 8:07 am

Glad you like =)
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: AllIn1 Super Canvas Functionality [Additions at bottom]

Postby GEuser » Wed Mar 20, 2013 2:10 pm

Ooh, missed this. (things get buried if you don't login regularly). I was looking to do similiar stuff but never got around to it. WIll check it out...
GEuser
 
Posts: 204
Joined: Thu Jan 05, 2012 3:08 pm
Score: 19 Give a positive score

Re: AllIn1 Super Canvas Functionality [Additions at bottom]

Postby Hblade » Wed Mar 20, 2013 3:26 pm

k, hope you enjoy.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to Game Demos

Who is online

Users browsing this forum: No registered users and 1 guest

cron