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 - NullEntity

Pages: [1]
1
General / Heap Corruption?
« on: June 24, 2011, 12:08:25 am »
So of course I rewrite it and it starts working fine.

2
General / Heap Corruption?
« on: June 23, 2011, 09:18:10 pm »
Can you try this? When I try replacing the defines with const ints, the window refuses to display again.

3
General / Heap Corruption?
« on: June 23, 2011, 07:20:07 pm »
Wow, I had to replace
sf::VideoMode(_WIDTH_*_ZOOM_, _HEIGHT_*_ZOOM_) with sf::VideoMode(_WIDTH_ * _ZOOM_, _HEIGHT_ * _ZOOM_)

4
General / Heap Corruption?
« on: June 23, 2011, 06:40:18 pm »
No, I have 2 GTX260Ms in SLi.

And here's my current code:
Code: [Select]
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>

#define _WIDTH_ 32
#define _HEIGHT_ 64
#define _ZOOM_ 20

int main()
{
    sf::RenderWindow App(sf::VideoMode(_WIDTH_*_ZOOM_, _HEIGHT_*_ZOOM_), "Test");
sf::View View(sf::FloatRect(0, 0, _WIDTH_, _HEIGHT_));
View.Zoom(_ZOOM_);
sf::Image Image(_WIDTH_, _HEIGHT_, sf::Color(0, 0, 0));
sf::Sprite Sprite;
sf::Uint8 *Display = new sf::Uint8[_WIDTH_ * _HEIGHT_ * 4];

while(App.IsOpened())
{
sf::Event e;
while(App.GetEvent(e))
{
if(e.Type == sf::Event::Closed)
App.Close();
}

for(int i = 0; i < _WIDTH_; i++)
for(int j = 0; j < _HEIGHT_; j++)
{
Display[(j+i*_WIDTH_)*4] = i*j % 255; // R
Display[(j+i*_WIDTH_)*4+1] = i*j % 255; // G
Display[(j+i*_WIDTH_)*4+2] = i*j % 255; // B
Display[(j+i*_WIDTH_)*4+3] = 255; // A
}

App.Clear();
Image.LoadFromPixels(_WIDTH_, _HEIGHT_, Display);
Sprite.SetImage(Image);
App.Draw(Sprite);
App.SetView(View);
App.Display();
}

delete [] Display;
    return 0;
}

5
General / Heap Corruption?
« on: June 23, 2011, 06:29:06 pm »
Now I actually put my rendering code in the right place, but it's still not displaying.

6
General / Heap Corruption?
« on: June 23, 2011, 06:27:41 pm »
FML. It's working now, but the window isn't showing. When I put my cursor over the icon on the taskbar, I can preview it, but it's not popping up/displaying.

7
General / Heap Corruption?
« on: June 23, 2011, 05:39:47 pm »
I always had difficulties with pointers. I'm trying to duplicate the code here to draw pixels on the screen. I think the issue is with my pointer to Display.

Here's my code:
Code: [Select]
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>

#define _WIDTH_ 32
#define _HEIGHT_ 64
#define _ZOOM_ 20

int main()
{
    sf::RenderWindow App(sf::VideoMode(_WIDTH_*_ZOOM_, _HEIGHT_*_ZOOM_), "Test");
sf::View View(sf::FloatRect(0, 0, _WIDTH_, _HEIGHT_));
View.Zoom(_ZOOM_);
sf::Image Image(_WIDTH_, _HEIGHT_, sf::Color(0, 0, 0));
sf::Sprite Sprite;
sf::Uint8 *Display = new sf::Uint8[_WIDTH_ + _HEIGHT_ * 4];

while(App.IsOpened())
{
sf::Event e;
while(App.GetEvent(e))
{
if(e.Type == sf::Event::Closed)
App.Close();

for(int i = 0; i < _WIDTH_; i++)
for(int j = 0; j < _HEIGHT_; j++)
{
Display[(j+i*_WIDTH_)*4] = i*j % 255; // R
Display[(j+i*_WIDTH_+1)*4] = i*j % 255; // G
Display[(j+i*_WIDTH_+2)*4] = i*j % 255; // B
Display[(j+i*_WIDTH_+3)*4] = 255; // A
}

App.Clear();
Image.LoadFromPixels(_WIDTH_, _HEIGHT_, Display);
Sprite.SetImage(Image);
App.Draw(Sprite);
App.SetView(View);
App.Display();
}
}

delete [] Display;
    return 0;
}

8
Window / Scaling a Window?
« on: June 23, 2011, 04:47:07 pm »
The intention is to keep the pixely look. I meant something like is there a setting that can scale the 64x32 resolution to whatever size the window is. I'm new to SFML so the only way I can think of is drawing boxes for each pixel.

9
Window / Scaling a Window?
« on: June 23, 2011, 05:51:03 am »
I want to make a Chip-8 emulator. It has a 64x32 screen. What would be the best/easiest way to scale it up to a more sensible resolution?

Pages: [1]