Recent

Author Topic: Doubling resolution?  (Read 3237 times)

Rave

  • Full Member
  • ***
  • Posts: 160
Doubling resolution?
« on: March 05, 2013, 12:29:38 am »
I'm making retro game and would want to know how can I double resolution so I can make this cool, pixelated look to it. I don't mean screen resolution, just game's.

I'm using TImage for that, because 1) I can easily save screenshots 2) Don't need to use OnPaint.

Supposedly I could do something like this:

Code: [Select]

const:
RealResX=320;
RealResY=240;
procedure Timer1Timer(Sender:TObject);
begin
Image1.width:=RealResX;
Image1.Height:=RealResY;
renderframe;
Image1.width:=RealResX*2;
Image1.Height:=RealResY*2;
end;

with Image1's Stretch set to true, but I'm afraid it would cause too much flickering.

lainz

  • Guest
Re: Doubling resolution?
« Reply #1 on: March 05, 2013, 12:34:05 am »
TImage maybe it's slow, try BGRABitmap that also has alpha support cross platform, and you can use a Resample Filter or a pixelate effect.

There are some game examples that comes with BGRAControls package, it comes with TBGRAGraphicControl that is similar to TPaintBox..

Check both in the wiki.

-PD: Your game is open source or paid, just for curiosity

Rave

  • Full Member
  • ***
  • Posts: 160
Re: Doubling resolution?
« Reply #2 on: March 05, 2013, 01:00:47 am »
My game is still in early phase of development ;). Also I don't need Alpha, as my game will use custom graphic format tailored to way game works (kinda like NES' CHR files). So I need to go as low level as possible, but not too much low-level. That's why I want to use TImage - I can easily save screenshots and don't need to do a thing in OnPaint event - if another window moves over my game's, screen won't "disappear".

Also, maybe I wasn't clear enough. That's ok.

The flickering I'm afraid of is due to constantly resizing TImage as in my code sample, not speed of drawing operations.

I'm afraid of something like this (epilepsy warning): http://imgur.com/ke1NmNB - not actual in-game graphics.

//edit: Also if I decide to release sources of my game, you probably won't learn anything from it. My code is terrible and even I barely understand it. But hey, it works!
« Last Edit: March 05, 2013, 01:27:39 am by Rave »

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Doubling resolution?
« Reply #3 on: March 05, 2013, 06:46:01 am »
If you only need to do
Code: [Select]
Image1.width:=something...;
Image1.Height:=something...;
once in your program, there should be no problem. The real size of image underneath is gotten by
image1.Picture.Width and Height. So if you stretch, the image1.Picture.Bitmap.Canvas is not the same size as image1.Width and Height.

Rave

  • Full Member
  • ***
  • Posts: 160
Re: Doubling resolution?
« Reply #4 on: March 05, 2013, 12:51:03 pm »
The real size of image underneath is gotten by
image1.Picture.Width and Height. So if you stretch, the image1.Picture.Bitmap.Canvas is not the same size as image1.Width and Height.
Thanks! Als this helped me fixing bug in gfx editor for my game (it does use custom graphic format, so I needed to make graphic editor as well).

lainz

  • Guest
Re: Doubling resolution?
« Reply #5 on: March 05, 2013, 03:10:07 pm »
Ok no problem =)

BTW if you have time check BGRAControls, there are some games: a maze game, a puzzle, a math game (somewhere).

If you publish your game maybe will be interesting to add to our library.

 

TinyPortal © 2005-2018