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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Jallen

Pages: [1] 2 3
1
DotNet / Nuget package wrong readme
« on: June 15, 2024, 07:41:36 pm »
Hi,

Just a heads up, the readme showing on the .NET nuget package looks to be showing the wrong readme file

https://www.nuget.org/packages/SFML.Net#readme-body-tab

Currently it just reads as...

Quote
SFML.Net NuGet Metapackage

This folder is used to build the SFML.Net Metapackage, which has no content by itself, but contains all SFML Modules as dependencies, allowing consumers to target a single NuGet Package (SFML.Net) when building new applications.

Which I assume is some internal readme for the folder representing the overall SFML meta package rather than being designed as a consumer-facing description of what the package does

Love that SFML is available for .NET, especially that it's available via nuget by the way. Cheers.

2
Just implemented Conway's game of life with this https://github.com/Jallenbah/simple-game-of-life

3
SFML projects / Re: Creating a classic game
« on: August 26, 2022, 08:58:27 pm »
Hey,

I was wondering if you did the .NET port? Because I would like to ask if I could use it.

Best regards pizzadox

For the benefit of anyone else stumbling across this thread, the SFML .Net bindings are available on Nuget on the Zlib license (at the time of me writing this post), which is very permissive. By reading the license you can see whether you can use it without asking.
https://www.nuget.org/packages/SFML.Net/

4
Looks neat! :)

Kind of wonder though, if the design of a single frame draw callback function is good enough for more complex things.

I feel like calling a function on the PixelWindow and passing in the pixel data, would feel more natural, but you'd then of course have to move the main loop outside of the PixelWindow.

Thanks, you're right - it doesn't give you the complete flexibility of controlling the loop, but through constraining the way you use it and forcing you to work within those 4 functions to control the application, it gives you a kind of "work with what you're given" simplicity, where you don't really (and can't, without modifying it) need to think about how the loop is structured or anything like that, which is why I went down this route. I guess it's somewhat inspired by the update functions you can override on Unity entities.

I think within the render function, you could go to town if you wanted to and fire off multiple threads, break it down into several other methods etc. and build up a pretty complex pipeline, especially if you created a class which had public methods of the types the constructor takes, you could do something like

var app = new Application();
var window = new PixelWindow.PixelWindow(1024, 576, 8, "Big pixels",
    app.OnLoad,
    app.Update,
    app.FixedUpdate,
    app.Render);
window.Run();
 

Actually I think I will make a commit to make doing that simpler, if I create an IPixelWindowAppManager interface which contains a contract for those 4 methods which people can then implement, I can also create an alternative constructor which takes an instance of that interface. That way you can just do

class MyPixelWindowAppManager : IPixelWindowAppManager {
    // implement onload, update, fixedupdate, and render from interface
}

var appManager = new MyPixelWindowAppManager();
var window = new PixelWindow.PixelWindow(1024, 576, 8, "Big pixels", appManager);
window.Run();
 

Thanks for the feedback 👍



EDIT - I've now made the changes to the way you set this up so you pass in an implementation of a provided interface instead of willy-nilly callbacks (see https://github.com/Jallenbah/pixelwindow/blob/master/src/App/Program.cs). Hopefully you think this is better rather than worse. I am more happy with it following these changes. Thanks again for your feedback eXpl0it3r

5
I've recently started working on a raycaster, and I needed a way to draw direct pixel graphics to the screen. Given I've used and enjoyed using SFML before, it was the natural choice for me. I'm using the .net binding in C# via the nuget package. This isn't anything special compared to some of the awesome games and apps people have made on here, but in the off chance anyone wants to do some direct pixel work, feel free to fork my repo and use it however you like.

https://github.com/Jallenbah/pixelwindow

What it is: A simple framework for drawing realtime direct per-pixel graphics in C# for applications such as raycasters, raytracers, and retro games. This uses the .Net binding of SFML for rendering, which allows for easy use of its additional functionality such as image loading, audio, and input.

This framework allows you to render at magnified pixel sizes, for example, the following example program will create a window of size 1024x576, with pixels 8x screen pixel size, resulting in a 128x72 drawing area.

new PixelWindow(1024, 576, 8, "Big pixels", ...



When you create the window, you give an instance of a class overriding a simple interface (IPixelWindowAppManager.cs) with functions for the following -
  • An onload function which gives you the SFML window so you can use it for input etc.
  • An update function which runs every frame
  • An update function which runs once per fixed timestep increment
  • A render function which runs every frame and gives you access to set direct pixel data

A basic setup can be seen in Program.cs, which renders randomly coloured pixels at as high a framerate as it can up to the specified framerate limit. As seen in the window title (showing a total render time of 0.5ms), this is able to render at a couple of thousand frames per second, so the performance of the framework shouldn't hold back the performance of your rendering code on modern hardware.

Cheers

6
Awesome, thanks Hapax. Your PXL8 project looks like it does exactly what I'm after - I think I will go for the rendertexture approach.

The thing with scaling everything up is it looks clearly pseudo-retro. Pixelated objects will transition smoothly across the screen which is not the case if you actually render at a lower resolution. The pixels of the background and the foreground should never overlap, they should line up exactly.

7
Graphics / Most efficient way to render at a scaled down resolution?
« on: July 18, 2017, 09:29:24 pm »
Hi, what's the most efficient way for me to render at a lower / scaled down / pixelated resolution? The goal is a retro pixelated appearance - but of course rendering at a lower resolution has its performance benefits so I don't want to take the shader route.

I've thought of these two -
- Creating the window at the desired downscaled resolution then scaling the window up
- Draw to a rendertexture of the desired size then render it as a scaled up sprite that fills the screen

I wanted to see what people thought before I committed to implementing it to avoid having to go through and benchmark both methods if it can be avoided.

Thanks!

8
SFML projects / It's Raining Snow! - A retro-arcade style Christmas game!
« on: January 13, 2011, 10:26:07 pm »
Thanks. I did the font system myself, yes. I first loaded all of the character images into a std::Vector of a struct containing a character which represents that image and the sf::Image itself, so it was like

Code: [Select]
struct CharImg
{
    char cha;
    sf::Image img;
};

(using integer ascii codes is useful for this so you can loop-load them)

Then I made a function which gets a desired character image pointer, like so:
Code: [Select]

sf::Image* Font::GetCharImage(char character)
{
for(int i = 0; i < chars.size(); i++)
{
if(chars[i]->cha == character)
return &chars[i]->img;
   }

return 0;
}


Then for the font drawing, I do something like this:
Code: [Select]
void Font::DrawText(std::string string, sf::Vector2f position, sf::Vector2f scale, sf::RenderWindow* rwindow)
{
std::vector<sf::Sprite> spriteVector;
sf::Vector2f nextpos(position);

for(int i = 0; i < string.length(); i++)
{
if(string[i] == '\n')
nextpos = sf::Vector2f(position.x, nextpos.y + (10 * scale.y));
else if(string[i] == ' ')
nextpos.x += (7 * scale.x);
else
{
spriteVector.push_back(sf::Sprite(*GetCharImage(string[i]), nextpos, scale));
nextpos.x += (7 * scale.x);
}
}

for(int i = 0; i < spriteVector.size(); i++)
{
rwindow->Draw(spriteVector[i]);
}
}

So not super efficient, creating a vector of the sprites each time I want to draw the text, but I wasn't concerned with that at the time since I was on a time limit for a small competition on another forum.

As you can see, for a newline I take the initial position and add some Y to it, that will put me below the first char in the text. For a space I simply advance the X position and for any other char I display the image and advance the X position.

Hope this helped!

9
SFML projects / It's Raining Snow! - A retro-arcade style Christmas game!
« on: December 26, 2010, 01:11:49 pm »
Quote from: "Hugo"
Doesn't work on Linux


Do you mean in Wine? The only non-sfml win32 stuff I used was WinMain and ShellExecuteW for the website link on the game-over screen, so I would be surprised if it wouldn't work in Wine.

10
SFML projects / It's Raining Snow! - A retro-arcade style Christmas game!
« on: December 25, 2010, 02:25:41 pm »
It requires the VC++ 2010 redist.

Thanks for the responses :)

11
SFML projects / It's Raining Snow! - A retro-arcade style Christmas game!
« on: December 24, 2010, 05:08:51 pm »
Hey guys, I just finished this little christmas game. It took only about 7 hours but I'm really happy with how it turned out.



Thanks!

There's a video, info, pics and download at my site, here:
http://jallenbah.co.uk/rainingsnow.php

12
SFML projects / [sf3d] a project for 3D rendering
« on: August 20, 2010, 07:42:12 pm »
The sample code looks cool, but I don't understand why you would piggy back on SFML when you could use something much more minimalistic with identical results.

13
SFML projects / Gravity Particles Simulator (sandbox)
« on: July 15, 2010, 12:18:50 pm »
Awesome, thanks :D

14
SFML projects / Gravity Particles Simulator (sandbox)
« on: July 14, 2010, 07:31:10 pm »
Info, Screenshots, Video, Download:
http://jallenbah.co.uk/particlesim.php
The image doesn't do it justice at all, on the page is a video, and the download is only small. But I think it's pretty fun and addictive.

Thanks.
http://i32.tinypic.com/20hvcqa.jpg

15
That's impossible to do in the program because they would need the VC++ 2010 redist to see the message in which I told them to get it.

I added info about the redist to the mouse tracker page, but it's not a bug so it doesn't need "fixing" as such.

Pages: [1] 2 3
anything