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.


Topics - Jallen

Pages: [1]
1
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

2
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!

3
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

4
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

5
Recently when making This I had to write my own line drawing function because I was unable to draw to an sf::Image.

Being able to draw to sf::Image would be a serious improvement I feel, it would definitely be an improvement to SFML. In fact I found it quite strange that I couldn't draw to an sf::Image.

Thanks.

6
http://jallenbah.co.uk/mousetracker.php
^ There's the page on my site for it.

It basically gets your mouse position using the Win API function GetMousePos() and adds a line to the image every 1/45th of a second between your current point and last point. The results can be both artistic and interesting.

Click for screen:
http://i48.tinypic.com/245im8j.jpg
(linked instead of tagged because it's 1280x1024)

7
General / Image::LoadFromPixels() - Don't understand.
« on: June 29, 2010, 04:30:13 pm »
Hello. I'm accessing pixel data directly but just doing image.SetPixel() is too slow. I read a while back that it's faster to simply work on my own array and then use Image::LoadFromPixels().

The problem with this is I can't seem to figure out how to get my pixel data from my image (Image::GetPixelsPtr() looks like what I want but ???), into a workable array, and then back into my image...

So how do I do this?
I'm using SFML 1.6

Thanks.

8
SFML projects / Fancy Pong Game
« on: June 27, 2010, 06:25:03 pm »
Hello.

I recently made a slightly different game of pong, I wanted to make a simple game and make it really polished, since it's almost impossible for one person to make something really complex also really good.

So anyway, this game of mine has a fancy menu, scores system, pausing and such.

Screens, Video, Info and Download here:
http://jallenbah.co.uk/pong.php

9
General / Trouble getting SFML working with my Win32 window.
« on: February 05, 2010, 05:23:34 pm »
Ok, I am making an editor for my game using SFML to display the GUI and Irrlicht to display the viewport. My problem is that the SFML part isn't working at all, it should be in that little light patch on the right (it's light because thats the window colour, sfml is literally not displaying at all, not even a blank colour)


This is my WinMain
Code: [Select]
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
HWND hWnd = InitialiseWin32Window(hInstance);
Viewport* viewport = new Viewport(hWnd, hInstance);
ControlPanel* controlpanel = new ControlPanel(hWnd, hInstance);

MSG msg;
while(true)
{
if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
if(msg.message == WM_QUIT)
break;
}
viewport->Run();
controlpanel->Run();
Sleep(0);
}
delete controlpanel;
delete viewport;
return 0;
}


Control Panel header
Code: [Select]
#ifndef ControlPanel_h
#define ControlPanel_h

#include <windows.h>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

class ControlPanel
{
public:
ControlPanel(HWND hWnd, HINSTANCE hInstance);
~ControlPanel();

void Run();

protected:
HWND SfmlControlPanel;
sf::RenderWindow* renderpanel;
};

#endif


And Control Panel source file
Code: [Select]
#include "ControlPanel.h"

ControlPanel::ControlPanel(HWND hWnd, HINSTANCE hInstance)
{
SfmlControlPanel = CreateWindowW(L"STATIC", NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
864, 0, 160, 600, hWnd, NULL, hInstance, NULL);
renderpanel = new sf::RenderWindow(hWnd);
}

ControlPanel::~ControlPanel()
{
delete renderpanel;
}

void ControlPanel::Run()
{
renderpanel->Clear(sf::Color(255,0,0));
renderpanel->Display();
}


I really have no idea why it's not working, as you can see I am trying to display that entire rectangle as red and nothing is displaying at all.
As you can see irrlicht is working correctly, so it shouldn't be a problem with my main window.

Thanks

10
General / Best way to set and get the values of individual pixels?
« on: January 22, 2010, 01:06:15 pm »
Hello.

I've been using SFML for some time now but I'd like a way to start making things like ray tracers and other things which are made by manually accessing and setting the values of pixels in the window.

So really what I want is something like
Code: [Select]
sf::Color GetPixel(int x, int y);
And
Code: [Select]
void SetPixel(int x, int y, sf::Color colour);

Is there anything like that?
Many thanks in advance.

11
SFML projects / Roller coaster simulator
« on: July 04, 2009, 11:18:39 am »
I hadn't even thought to post it on the SFML forums, but I just realised, after making it a few weeks ago for my final computing project that you guys might like it.

YOUTUBE VIDEO OF IT BEING USED






Hope you like it :D

12
Window / Getting the window handle
« on: February 20, 2009, 01:03:46 pm »
I'm using SFML for my A level computing project, a physics simulation for my school.
I have a problem however, as I made my own GUI system and I am using SFML's input system. When you make the window size different, the mouse position is incorrect, so clicking a button will click somewhere entirely different.

How can I stop the window from being resized or made fullscreen?

Also, I'd like to be able to get the hWnd, how can I do that?

Problem 1 solved
Code: [Select]
sf::RenderWindow* rwindow = new sf::RenderWindow(sf::VideoMode(800, 600), "Roller Coaster Simulator", sf::Style::Close);

Now, how can I get the hWnd?

Pages: [1]
anything