RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
How do I create a viewport as an ellipse?

0 Members and 1 Guest are viewing this topic.

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Right well I am scripting an extra viewport into the main map that's to be used if you're doing something special; it works fine as is, but the problem I have with it is that it just looks way too blocky and disgusting, I was wondering if there's a way to convert either the Viewport rect into an Ellipse or to just draw th viewport as an Ellipse on it's own accord?

Spoiler for what it currently looks like:
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

*
Rep:
Level 82
Cannot guarantee accuracy on this, but...

The built-in Viewport class only works with rectangles as far as I can tell. It just doesn't have the capability to work with non-rectangular viewports. It's pretty likely you'll have to write your own class if you wanted to have it completely non-rectangular.

You might be able to integrate some kind of clipping processes that works with the rectangle viewport. It would be like constructing an ellipse inside of the rectangle, with pixels on the outside of that shape not being drawn. It wouldn't be too hard to mathematically model the ellipse from the rectangle bounds.

Whether that would work or not, I can't say. My knowledge on graphic programming is limited at best. It works in my head is about as much as I can say.
(Why do I always feel like it's the end of the world and I'm the last man standing?)

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Seems likely that I'll need to go for that :-\ Guess I'll have a little wait for some more opinions though ^-^
Thanks Logan
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

**
Rep:
Level 66
RMRK Junior
Yeah, you can only create rectangular viewports by default, but someone made a script that allows for irregularly shaped viewports. You could try looking for that. I think it's over on Chaos Project somewhere.

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
That script actually does something with sprites and masking them rather than doing anything with the viewport class on its own. It's helpful, but as this script doesn't use a sprite in the viewport, it's unusable :-\
I guess the question now is where can I find a written version of the Viewport class (even if it's written in C), the default scripts and help docs are not giving me anything to work with and neither is anything I can find via googling ;9
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

***
Rep:
Level 70
RMRK Junior
I believe Viewports are intended to draw shapes based on the shapes of Monitors, and to my knowledge, elliptical Monitors arent really very popular.

A window is a bit different.  You might be able to draw a Window and specify a non rectangular shape.  If you really wanted, you could even draw that non rectangular Window in a new rectangular shaped Viewport.

We might be able to suggest some other ways to go about accomplishing what you are trying to accomplish if we knew a bit more about what you were doing.

This might help:
http://forum.chaos-project.com/index.php/topic,10239.0.html

This might help also:
http://www.hbgames.org/forums/viewtopic.php?f=11&t=9417&sid=88d01c32c734dcf19d398dc6af964840
« Last Edit: December 11, 2012, 07:28:52 AM by Heretic86 »
Heretic's Vehicles XP (Boat and Magic Carpet)

Heretic's Collection XP Ver 2.3 - Updated to include Dynamic Lighting, Moving Platforms, Vehicles, and much much more!

*
Rep:
Level 82
You are incorrect about your understanding of viewports.

From wikipedia:

Quote
In 3D computer graphics it refers to the 2D rectangle used to project the 3D scene to the position of a virtual camera. A viewport is a region of the screen used to display a portion of the total image to be shown.

This can also be used in 2D graphics too, as it is in RPG Maker.

And from RMVX Ace:

Quote
Used when displaying sprites on one portion of the screen, with no overflow into other regions.

In the screenshot D&P3 provided, there are two viewports being used. One of them is the main viewport that is used to draw everything on the screen. The second viewport is the pink square that has been created to overlay the first viewport. If you are working with the second viewport and wanted to draw a sprite outside the armour shop or next to that well, it wouldn't display. It would still be drawn in memory, but you won't actually see it on the map.

The objective of D&P3's script is to be able to portion off a particular region of the screen so that you can perform some kind of graphical stuff without worrying about it spilling out into the rest of the screen and the game map. To do that, he'd need to make use of another viewport. Which he has done. He just isn't happy with the rectangular viewport because it doesn't look smooth and would rather it look a little prettier.

The link to Chaos Project is very useful, as I'm sure D&P3 can use that to understand what he is trying to do. The script comments are in Spanish, however, so it might be fun.

Just to help clarify the difference between display and viewports, an image from the Chaos-Project site is relevant:

http://img163.imageshack.us/img163/9381/sinttulo1qh.jpg

Each of those shapes are a particular shape of the viewport (that the script there can create). It's not that people have Mickey Mouse shaped monitors that's the reason that shape is useful. But you might use it because you want to display the game map within that shape so that you mask out the map graphics outside of that shape's bounds. If that makes any sense.
(Why do I always feel like it's the end of the world and I'm the last man standing?)

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Viewports are actually dynamic (and as far as I can tell, are usually made for 3D games), Windows/Areas on the other hand are created with the intent to be within your monitor region (usually for retro 2D games) and the idea is that the last thing you draw is what takes priority. So if I was to draw rain before drawing a level, any rain sprite that was at the same position as any part of the level would be hidden, same for if I was drawing a player just after an enemy; if the player was standing where an enemy was you wouldn't see the enemy. SDL/OPEN_GL uses this for 2D games. RPG Maker uses viewports though, so everything that's closer to you by the z axis is more visible than others, I'll stop there because I'll feel like I'm insulting your intelligence if I keep on blabering; sorry if you feel that way ;9

Logan, that was the script I saw earlier. It affects sprites mainly and masks them somehow, by default it doesn't really affect the viewport and I'm not 100% sure on how I can use this for rewriting the default viewport class, I am in fact a bit lost on how to rewrite the viewport class in the first place because there seems to be literally no documentation on it whatsoever (so I have no idea how it's doing most of what it's doing anyway).

Getting it to draw as a circle shouldn't be too difficult once I know the basics behind it; the following code used in OPEN_GL draws a circle just fine, so I should have that art covered at least ;8
Code: [Select]
void DrawCircle::Draw( float fScreenRightBorder, float fScreenBottomBorder )
{
float fRed = m_iRandomRedColour   * 0.003921f; // Red Divided by 255 to get a float value
float fGreen = m_iRandomGreenColour * 0.003921f;
float fBlue = m_iRandomBlueColour * 0.003921f;

glBegin(GL_TRIANGLE_FAN);

glColor4f(fRed, fGreen, fBlue, 1.f);
glVertex2f((fScreenRightBorder * 0.5f) , (fScreenBottomBorder * 0.5f));

for (float i=0; i <= 360; i += 10)
{
m_fAngle = m_oUtilities->DegToRad(i);

if (m_fRadious <= 500)
{
m_fRadious+= 0.1f;

if (m_fRadious >= 500)
{
m_fRadious = 1000;
}
}

else
{
m_fRadious -= 0.1f;
}

glColor4f(fRed * 0.5f, fGreen * 0.5f, fBlue * 0.5f, 1.f);
glVertex2f((fScreenRightBorder * 0.5f) + (cos(m_fAngle) * m_fRadious),
(fScreenBottomBorder * 0.5f) + (sin(m_fAngle) * m_fRadious));



}

glEnd();
}
« Last Edit: December 11, 2012, 03:17:37 PM by D&P3 »
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Utilising some advice I got from Tsukihime here
This is the closest I've managed to get it so far; I wonder if it's possible to change the z axis in particular regions of a viewport, so as to make the edges of this sprite fade behind the regular map viewport?

All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

***
Rep:
Level 70
RMRK Junior
I dont think you can change the Z in regions, only the objects (sprites) that occupy the viewport.
Heretic's Vehicles XP (Boat and Magic Carpet)

Heretic's Collection XP Ver 2.3 - Updated to include Dynamic Lighting, Moving Platforms, Vehicles, and much much more!