Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Selba Ward  (Read 39396 times)

0 Members and 1 Guest are viewing this topic.

salianifo

• Newbie
• Posts: 2
Re: Selba Ward
« Reply #120 on: May 21, 2017, 10:57:54 pm »
Are you planning on adding a feature to the Nine Patch to allow multiple stretching sections? Something along the lines of what this post on StackOverflow is trying to achieve?

Hapax

• Hero Member
• Posts: 2933
• My number of posts is shown in hexadecimal.
Re: Selba Ward
« Reply #121 on: May 22, 2017, 02:40:32 pm »
There are currently no plans to expand Nine Patch to have more than nine patches although it can be a consideration for the future.

Note that it can be achieved by displaying Nine Patches together.
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

Hapax

• Hero Member
• Posts: 2933
• My number of posts is shown in hexadecimal.
Re: Selba Ward
« Reply #122 on: August 07, 2017, 05:17:52 pm »
Update!

Elastic Sprite (wiki)
v1.1
Added ability to use perspective interpolation instead of bi-linear interpolation.

Bi-linear interpolation can look 'rubbery' but remains evenly distributed and edges match easily. Note that lines can be bent (notice the red diagonal squares 0-9 in the examples below); then again, it is technically a similar method to calculating bezier curves...
Perspective interpolation adjusts the apparent 3D rotation of the quad to match the vertices' positions. This is similar to Photoshop's free transform's individual corner manipulation. Note that distribution is no longer even and edges will not match so easily.

Compare below.

Bi-linear:

Perspective:

One additional thing to note is that the RGB components of the sprite's colour are disabled when drawn using perspective interpolation; the alpha is used as normal.
The reason for this is because an extra "weight" float per vertex that would be interpolated like other vertex attributes is needed. Since SFML's vertex format is rigid and only has 2d position and texture co-ordinates, this value could not be passed through a spare. This led to the decision to encode the float into the three colour (RGB) components of the sprite's colour.
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

Hapax

• Hero Member
• Posts: 2933
• My number of posts is shown in hexadecimal.
Re: Selba Ward
« Reply #123 on: June 05, 2019, 02:51:57 am »
(summary since previous post)

Console Screen (wiki)
v2.4.1
- Can stream numbers using the new Number type.
- Can now get cell location of a given co-ordinate
- Can get (transformed) co-ordinate of a cell location.
- New 8-bit RGB palette
- Can now set the cell value used for 'clearing' a cell; it is no longer required to be zero.
- Can now customise the multiplier used for darkening a cell's colour when using Dark attribute (Bright has been swapped for Dark).

Tile Map (wiki)
v2.0.1
- Now fully templated.
- Connect the level when needed rather than having to pass it with every update.
- Level width is now also stored and can be changed separately.

Elastic Sprite (wiki)
v1.2
- Fixed perspective interpolation when used with larger texture or offset
- Perspective interpolation can now be used with colours

Spline (wiki)
v1.5
Multiple corner types
These are applied at every point (except start and end points) including interpolated ones.
They allow corners to take a form that is different from the original 'point' corner.

The corner types available are:
Point
The original type. This extends the edges until they meet. This has no limit.
PointLimit
Similar to Point. This extends the edges until they meet. However, if the length of this point is greater than the maximum allowed length (customisable), this point is 'pulled inwards' until it reaches that length.
PointClip
Also similar to Point. This extends the edges until they meet. However, if the length of this point is greater than the maximum allowed length, this corner is converted into a bevel-style corner (see below).
Bevel
This does not extend the edges until they meet. The two corners of the rectangles - that make up the two joining thick straight lines - are joined together.
Round
This also does not extend the edges until they meet. This is similar to Bevel except the the corners are joined together using a circular curve. The interpolation level of round corners can also be customised; a level of zero is visually equivalent to a bevel corner.

Multiple cap types
Caps are how the start and end of the Spline are drawn.
Each cap (start and end) can be customised separately.
Available cap types:
None
This adds nothing to the spline. It therefore appears as a flat edge that passes across the vertex.
Extended
This extends the flat edge so that it is half of the thickness of the Spline away from the vertex. This leaves half thickness around the vertex.
Round
This adds a semicircle to the flat edge. The centre of the semicircle is the vertex. Its radius is half of the thickness. It reaches the same distance as the Extended type. This leave half thickness around the vertex.
The interpolation level of round corners can be customised; a level of zero is visually equivalent to "None" and a level of one is a "triangle" cap.

Random normal offsets
Each point (including all interpolated points) can be offset along its normal by a random amount. The range of this random distance can be customised. Each vertex also has this range so it is interpolated and multiplied in a similar way to the thickness and vertex thicknesses. The offset, however, is centred on the original Spline path. This allows 'lightning' style effects.

Optimisation
The updates have been optimised, allowing only the visual representation to be updated if the Spline itself hasn't moved or interpolation settings haven't changed. Basically, as long as it doesn't need to calculate the points or interpolation points, just the visual representation can be updated separately.

Note that the corner and cap types only apply to a thick Spline whereas the random normal offsets apply to both a thick and a thin Spline.

Simple Example 3b (thick with rounded corners and caps):

Simple Example 4b (thick with rounded corners and caps):

Simple Example 1b (random normal offsets - lightning):

General
Numerous fixes that include compiler errors or other bugs.
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

Mills

• Newbie
• Posts: 10
Re: Selba Ward
« Reply #124 on: January 26, 2020, 11:40:57 pm »
I want to thank you for the amazing console screen, it is just what I was looking for, to make a simple text editor in SFML .

Now I'm using CSFML, so I can't use this, but I wonder if I can build a little lib only with the console screen sources, or do I need to compile all sources for the console to work?

Hapax

• Hero Member
• Posts: 2933
• My number of posts is shown in hexadecimal.
Re: Selba Ward
« Reply #125 on: January 29, 2020, 09:12:22 pm »
Thank you for your kind words. It's always a good feeling when you hear that someone is enjoying Selba Ward.

I'm not sure I understand your move from C++ to C but I won't judge (too much)

Selba Ward is built so that each drawable object can be used separately from any of the others. So, to use just Console Screen, you can simply copy the files into your project and link them. The (3) files you need would be ConsoleScreen.hpp, ConsoleScreen.cpp and Common.hpp. You could, if you wish, also include PaletteEnums.hpp if you wish to use those but this is not required. Then, just compile along with the rest of your project.
It's worth noting, though, that the files themselves are written in C++ so would need converting to plain C first. Or you could build just those files as a library and use that. Never needed to do this though so it may or may not work or even be possible.

Hope it works out for you!
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

Mills

• Newbie
• Posts: 10
Re: Selba Ward
« Reply #126 on: February 05, 2020, 05:40:56 pm »
Thank you for your kind words. It's always a good feeling when you hear that someone is enjoying Selba Ward.

I'm not sure I understand your move from C++ to C but I won't judge (too much)

Selba Ward is built so that each drawable object can be used separately from any of the others. So, to use just Console Screen, you can simply copy the files into your project and link them. The (3) files you need would be ConsoleScreen.hpp, ConsoleScreen.cpp and Common.hpp. You could, if you wish, also include PaletteEnums.hpp if you wish to use those but this is not required. Then, just compile along with the rest of your project.
It's worth noting, though, that the files themselves are written in C++ so would need converting to plain C first. Or you could build just those files as a library and use that. Never needed to do this though so it may or may not work or even be possible.

Hope it works out for you!

Thanks a lot!

eXpl0it3r

• SFML Team
• Hero Member
• Posts: 9504
Re: Selba Ward
« Reply #127 on: April 12, 2020, 08:44:29 pm »
Just saw that you added the Pixel Display and while reading through the wiki page, I wondered, why is there no shiftUp/shiftDown?
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

Hapax

• Hero Member
• Posts: 2933
• My number of posts is shown in hexadecimal.
Re: Selba Ward
« Reply #128 on: April 12, 2020, 11:41:28 pm »
Well spotted! However, there is a reason...

What scrolling does is pretty obvious. The scroll movement can happen in either direction of either of the two dimensions.
It moves the pixels around the 2D space.

Shifting is different and is similar to bit shifting.
All pixels are stored in a single, one dimensional vector that wraps across the 2D space.
Shifting left moves all pixels in the vector left within the vector. This means that on the 2D display, they wrap onto the row above, not the same row.

To be more clear with a simple example:
A similar effect is having a text editor with "wrap" enabled and lots of characters without any line breaks. If you delete the first character, they all shift to the left. The letters from the left of a row appear at the end of the row above. If you deleted most of the characters, you could end with the characters from the bottom now on the top line.

I've probably explained this far too detailed and most people would understand it from the first part (without the example). The example is just for clarity.

Hope that helps
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter