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

Pages: [1] 2
1
SFML wiki / SFML CEGUI tutorial - updated code
« on: January 05, 2012, 06:20:19 am »
I'm personally interested in it being uploaded as well. I'm trying to integrate CEGUI into SFML2 as well.

2
Window / [SFML2] Retrieving screen aspect ratio and applying to view
« on: March 19, 2011, 09:39:11 pm »
Aspect ratio is width divided by height. Width is the larger number on just about all monitors. For example the aspect ratio derived from my monitor is 16 divided by 9 which comes out to be about 1.777778. So division is the proper operation.

What I need to do is find an equation to be able to identify when distortion will occur and then increase the view marginally to prevent distortion.

I was hoping someone already has done this or it was built into SFML somehow but I've still gotten no reply. =[

3
Window / [SFML2] Retrieving screen aspect ratio and applying to view
« on: March 19, 2011, 09:41:50 am »
Noone?

4
Window / [SFML2] Retrieving screen aspect ratio and applying to view
« on: March 14, 2011, 06:45:10 pm »
I was unsure whether to put this here or in the Graphics forum but basically I'm trying to set my camera view to a size of an equal aspect ratio of the monitor.

Code: [Select]
VideoMode videoMode = sf::VideoMode::GetDesktopMode();
float aspectRatio = (float)videoMode.Width/(float)videoMode.Height;
float screenSize = 380;

scene->view = new sf::View(sf::FloatRect(0, 0, screenSize, screenSize/aspectRatio));


Hypothetically this should work with any given screenSize but I'm still getting pretty profound distortion with certain numbers (such as 800 on a 16:9 monitor).

Is there a better way to control the field of view while still keeping the proper aspect ratio (no stretching) no matter what monitor you're on?

Thanks!

5
Graphics / SFML 1.6 to SFML 2.0 porting failure
« on: March 07, 2011, 08:26:55 pm »
Thank you so much both of you!

Everything's working now with the exception of a ghosting issue of sorts. I may take video to demonstrate.

6
Graphics / SFML 1.6 to SFML 2.0 porting failure
« on: March 03, 2011, 07:36:31 pm »
No one? =[

7
Graphics / SFML 1.6 to SFML 2.0 porting failure
« on: February 27, 2011, 02:43:55 am »
While trying to port a game engine to SFML2 originally made in 1.6 I've run into some problems. There are no compile errors but some tiles are not rendered and are instead left completely black. Here is the original code (works perfectly), the 2.0 port, and my typed out notes as I was porting. If any clarification is needed to help out let me know. Thanks for your time!

SFML 1.6 (Works perfectly)
header
Code: [Select]
/*
 *  RenderSystem.h
 *  GameEngine
 *
 *  Created by Jesse Werner on 1/30/11.
 *  Copyright 2011 none. All rights reserved.
 *
 */

#pragma once

#include <SFML/Graphics.hpp>
#include <vector>
#include "TileLayer.h"

using namespace sf;
using namespace std;

class RenderSystem
{
public:
RenderSystem(RenderWindow *myRenderWindow, float myRatio);
RenderWindow *renderWindow;
vector<Sprite*> renderList;
vector<TileLayer*> tileLayers;
float PTM_RATIO;

void render(View *view);

};



SFML 1.6 (works perfectly) cpp
Code: [Select]
/*
 *  RenderSystem.cpp
 *  GameEngine
 *
 *  Created by Jesse Werner on 1/30/11.
 *  Copyright 2011 none. All rights reserved.
 *
 */
#include <SFML/Graphics.hpp>
#include "RenderSystem.h"
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace sf;

RenderSystem::RenderSystem(RenderWindow *myRenderWindow, float myRatio)
{
renderWindow = myRenderWindow;
PTM_RATIO = myRatio;
}


void  RenderSystem::render(View *view)
{

    //printf("view center: %f,%f \n",view->GetCenter().x, view->GetCenter().y);
    //printf("view extents: %f,%f \n",view->GetHalfSize().x, view->GetHalfSize().y);
for(int i = 0; i<tileLayers.size(); i += 1)
{


for(int j = 0; j<tileLayers[i]->tiles.size(); j++)
{
Tile* tile = tileLayers[i]->tiles[j];

            //printf("(%f,%f) \n",tile->x * PTM_RATIO, tile->y * PTM_RATIO);
            if(tile->x*PTM_RATIO - view->GetCenter().x < view->GetHalfSize().x )
            {
                if(tile->x*PTM_RATIO - view->GetCenter().x > -view->GetHalfSize().x-1*PTM_RATIO)
                {
                    if(tile->y*PTM_RATIO - view->GetCenter().y < view->GetHalfSize().y )
                    {
                        if(tile->y*PTM_RATIO - view->GetCenter().y > -view->GetHalfSize().y-1*PTM_RATIO )
                        {
                            Image *src = tileLayers[i]->image;

                            int left = tile->tx;
                            int right = left + 16;
                            int top = tile->ty;
                            int bottom = tile->ty + 16;

                            Sprite sprite;
                            sprite.SetImage(*src);

                            sprite.SetSubRect(IntRect( left, top, right, bottom));
                            sprite.SetX(tile->x*PTM_RATIO);
                            sprite.SetY(tile->y*PTM_RATIO);

                            renderWindow->Draw(sprite);
                        }
                    }
                }
            }
}
}

for(int i = 0; i<renderList.size(); i++)
{
renderWindow->Draw(*renderList[i]);
}
renderList.clear();
}


SFML2 (does not work)
header
Code: [Select]
/*
 *  RenderSystem.h
 *  GameEngine
 *
 *  Created by Jesse Werner on 1/30/11.
 *  Copyright 2011 none. All rights reserved.
 *
 */

#pragma once

#include <SFML/Graphics.hpp>
#include <vector>
#include "TileLayer.h"

using namespace sf;
using namespace std;

class RenderSystem
{
public:
RenderSystem(RenderWindow *myRenderWindow, float myRatio);
RenderWindow *renderWindow;
vector<Sprite*> renderList;
vector<TileLayer*> tileLayers;
float PTM_RATIO;

void render(View *view);

};


SFML2 (does not work)
cpp
Code: [Select]
/*
 *  RenderSystem.cpp
 *  GameEngine
 *
 *  Created by Jesse Werner on 1/30/11.
 *  Copyright 2011 none. All rights reserved.
 *
 */
#include <SFML/Graphics.hpp>
#include "RenderSystem.h"
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace sf;

RenderSystem::RenderSystem(RenderWindow *myRenderWindow, float myRatio)
{
renderWindow = myRenderWindow;
PTM_RATIO = myRatio;
}


void  RenderSystem::render(View *view)
{

    //printf("view center: %f,%f \n",view->GetOrigin().x, view->GetOrigin().y);
    //printf("view extents: %f,%f \n",view->GetSize()/2().x, view->GetSize()/2().y);
for(int i = 0; i<tileLayers.size(); i += 1)
{


for(int j = 0; j<tileLayers[i]->tiles.size(); j++)
{
Tile* tile = tileLayers[i]->tiles[j];

            //printf("(%f,%f) \n",tile->x * PTM_RATIO, tile->y * PTM_RATIO);
            if(tile->x*PTM_RATIO - view->GetCenter().x < view->GetSize().x/2.0 )
            {
                if(tile->x*PTM_RATIO - view->GetCenter().x > -view->GetSize().x/2.0-1*PTM_RATIO)
                {
                    if(tile->y*PTM_RATIO - view->GetCenter().y < view->GetSize().y/2.0 )
                    {
                        if(tile->y*PTM_RATIO - view->GetCenter().y > -view->GetSize().y/2.0-1*PTM_RATIO )
                        {
                            Image *src = tileLayers[i]->image;

                            int left = tile->tx;
                            int right = left + 16;
                            int top = tile->ty;
                            int bottom = tile->ty + 16;

                            Sprite sprite;
                            sprite.SetImage(*src);

                            sprite.SetSubRect(IntRect( left, top, right, bottom));
                            sprite.SetX(tile->x*PTM_RATIO);
                            sprite.SetY(tile->y*PTM_RATIO);

                            renderWindow->Draw(sprite);
                        }
                    }
                }
            }
}
}

for(int i = 0; i<renderList.size(); i++)
{
renderWindow->Draw(*renderList[i]);
}
renderList.clear();
}




Changes made (sorry for lack of readability)
Code: [Select]

sprite class

getcenter ---> getorigin
setcenter ---> setorigin

view class

gethalfsize ---> getsize()/2
vectorf's must be redone because no more halfsize

string class
no longer has setposition function

renderwindow class
enable useverticalsync to EnableVerticalSync

windowsettings to contextsettings class

ensure defining SFML_STATIC

8
General / SFML2 Static Lib Linker Error
« on: November 08, 2010, 06:23:08 pm »
Laurent I have no idea how you help so many people, and develop an amazing framework, and have time for anything else in your life.

Thanks =D

Question to anyone who knows, I usually do defines in my project properties in visual studio (which works) but i'm just curious if I wanted to put it in my actual code what would be the actual syntax?

9
General / Changing Key Repeat Speed
« on: November 08, 2010, 01:25:12 am »
For Windows you can change the repeat speed by going to keyboard in control panel and playing with those values, although this probably doesn't help you much.

10
General / SFML2 Static Lib Linker Error
« on: November 08, 2010, 01:06:46 am »
I saw there were a few others of these but the proposed solutions didn't work.

I've tried downloading, compiling SFML2 with cmake, and compiling SFML2 three times with no results. I get the libraries but end up getting these linker errors when using the static debug libraries:

1>Game.obj : warning LNK4217: locally defined symbol ??0RenderWindow@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUContextSettings@1@@Z (public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::ContextSettings const &)) imported in function "public: __thiscall Game::Game(void)" (??0Game@@QAE@XZ)
1>Game.obj : warning LNK4217: locally defined symbol ??0VideoMode@sf@@QAE@III@Z (public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)) imported in function "public: __thiscall Game::Game(void)" (??0Game@@QAE@XZ)
1>Game.obj : warning LNK4217: locally defined symbol ??1RenderWindow@sf@@UAE@XZ (public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)) imported in function "public: virtual void * __thiscall sf::RenderWindow::`scalar deleting destructor'(unsigned int)" (??_GRenderWindow@sf@@UAEPAXI@Z)
1>Game.obj : warning LNK4217: locally defined symbol ?Display@Window@sf@@QAEXXZ (public: void __thiscall sf::Window::Display(void)) imported in function "public: void __thiscall Game::draw(void)" (?draw@Game@@QAEXXZ)
1>Game.obj : warning LNK4217: locally defined symbol ?Draw@RenderTarget@sf@@QAEXABVDrawable@2@@Z (public: void __thiscall sf::RenderTarget::Draw(class sf::Drawable const &)) imported in function "public: void __thiscall Game::draw(void)" (?draw@Game@@QAEXXZ)
1>Game.obj : warning LNK4217: locally defined symbol ?Clear@RenderTarget@sf@@QAEXABVColor@2@@Z (public: void __thiscall sf::RenderTarget::Clear(class sf::Color const &)) imported in function "public: void __thiscall Game::draw(void)" (?draw@Game@@QAEXXZ)
1>Game.obj : warning LNK4217: locally defined symbol ??0Color@sf@@QAE@EEEE@Z (public: __thiscall sf::Color::Color(unsigned char,unsigned char,unsigned char,unsigned char)) imported in function "public: void __thiscall Game::draw(void)" (?draw@Game@@QAEXXZ)
1>GameObject.obj : warning LNK4049: locally defined symbol ??0Color@sf@@QAE@EEEE@Z (public: __thiscall sf::Color::Color(unsigned char,unsigned char,unsigned char,unsigned char)) imported
1>GameObject.obj : warning LNK4217: locally defined symbol ??1Image@sf@@QAE@XZ (public: __thiscall sf::Image::~Image(void)) imported in function "public: __thiscall GameObject::GameObject(struct b2Vec2,struct b2Vec2)" (??0GameObject@@QAE@Ub2Vec2@@0@Z)
1>GameObject.obj : warning LNK4217: locally defined symbol ?SetColor@Drawable@sf@@QAEXABVColor@2@@Z (public: void __thiscall sf::Drawable::SetColor(class sf::Color const &)) imported in function "public: __thiscall GameObject::GameObject(struct b2Vec2,struct b2Vec2)" (??0GameObject@@QAE@Ub2Vec2@@0@Z)
1>GameObject.obj : warning LNK4217: locally defined symbol ?SetPosition@Drawable@sf@@QAEXMM@Z (public: void __thiscall sf::Drawable::SetPosition(float,float)) imported in function "public: __thiscall GameObject::GameObject(struct b2Vec2,struct b2Vec2)" (??0GameObject@@QAE@Ub2Vec2@@0@Z)
1>GameObject.obj : warning LNK4217: locally defined symbol ?SetOrigin@Drawable@sf@@QAEXMM@Z (public: void __thiscall sf::Drawable::SetOrigin(float,float)) imported in function "public: __thiscall GameObject::GameObject(struct b2Vec2,struct b2Vec2)" (??0GameObject@@QAE@Ub2Vec2@@0@Z)
1>TestGameObject.obj : warning LNK4217: locally defined symbol ?SetOrigin@Drawable@sf@@QAEXMM@Z (public: void __thiscall sf::Drawable::SetOrigin(float,float)) imported in function "public: __thiscall TestGameObject::TestGameObject(void)" (??0TestGameObject@@QAE@XZ)
1>GameObject.obj : warning LNK4217: locally defined symbol ?Create@Image@sf@@QAE_NIIABVColor@2@@Z (public: bool __thiscall sf::Image::Create(unsigned int,unsigned int,class sf::Color const &)) imported in function "public: __thiscall GameObject::GameObject(struct b2Vec2,struct b2Vec2)" (??0GameObject@@QAE@Ub2Vec2@@0@Z)
1>GameObject.obj : warning LNK4217: locally defined symbol ??0Image@sf@@QAE@XZ (public: __thiscall sf::Image::Image(void)) imported in function "public: __thiscall GameObject::GameObject(struct b2Vec2,struct b2Vec2)" (??0GameObject@@QAE@Ub2Vec2@@0@Z)
1>TestGameObject.obj : warning LNK4217: locally defined symbol ??0Image@sf@@QAE@XZ (public: __thiscall sf::Image::Image(void)) imported in function __ehhandler$??0TestGameObject@@QAE@XZ
1>GameObject.obj : warning LNK4217: locally defined symbol ?SetRotation@Drawable@sf@@QAEXM@Z (public: void __thiscall sf::Drawable::SetRotation(float)) imported in function "public: virtual void __thiscall GameObject::update(void)" (?update@GameObject@@UAEXXZ)
1>TestGameObject.obj : warning LNK4217: locally defined symbol ?LoadFromFile@Image@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z (public: bool __thiscall sf::Image::LoadFromFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported in function "public: __thiscall TestGameObject::TestGameObject(void)" (??0TestGameObject@@QAE@XZ)
1>Game.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Sprite::~Sprite(void)" (__imp_??1Sprite@sf@@UAE@XZ) referenced in function "public: void __thiscall Game::loadLevel(char *)" (?loadLevel@Game@@QAEXPAD@Z)
1>GameObject.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Sprite::~Sprite(void)" (__imp_??1Sprite@sf@@UAE@XZ)
1>Game.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Sprite::Sprite(void)" (__imp_??0Sprite@sf@@QAE@XZ) referenced in function "public: void __thiscall Game::loadLevel(char *)" (?loadLevel@Game@@QAEXPAD@Z)
1>GameObject.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Sprite::Sprite(void)" (__imp_??0Sprite@sf@@QAE@XZ)
1>GameObject.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Sprite::SetImage(class sf::Image const &,bool)" (__imp_?SetImage@Sprite@sf@@QAEXABVImage@2@_N@Z) referenced in function "public: __thiscall GameObject::GameObject(struct b2Vec2,struct b2Vec2)" (??0GameObject@@QAE@Ub2Vec2@@0@Z)
1>TestGameObject.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Sprite::SetImage(class sf::Image const &,bool)" (__imp_?SetImage@Sprite@sf@@QAEXABVImage@2@_N@Z)
1>GameObject.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Sprite & __thiscall sf::Sprite::operator=(class sf::Sprite const &)" (__imp_??4Sprite@sf@@QAEAAV01@ABV01@@Z) referenced in function "public: __thiscall GameObject::GameObject(struct b2Vec2,struct b2Vec2)" (??0GameObject@@QAE@Ub2Vec2@@0@Z)
1>C:\Users\Joe\Desktop\GameObjectClass\Windows\build\Static Debug\Game1.exe : fatal error LNK1120: 4 unresolved externals
1>
1>Build FAILED.

Any suggestions?


P.S. Code currently works with Dynamic Debug so it's not the code.

Thanks!

11
General discussions / SFML Cross-Platform Stability?
« on: November 08, 2010, 12:56:05 am »
Thanks Laurent, Ceylo, and Hiura. I appreciate the help and responses. I've been porting my applications from SFML 1.6 to SFML2 without any problems and am satisfied with the stability of SFML2. =]

@Ceylo I wish I was running a developer preview =]

12
General discussions / SFML Cross-Platform Stability?
« on: November 06, 2010, 09:19:12 pm »
Awesome thank you!

sorry for last question misunderstanding, I meant how long until you think it will be released as a stable version.

I really appreciate all the work you guys do by the way. =] nice work.

13
General discussions / SFML Cross-Platform Stability?
« on: November 06, 2010, 09:05:03 pm »
Thanks a bunch Luarent. A few more questions for clarification:

-So SFML 2 is actively maintained on all the platforms, Win/Mac/Linux?

-How difficult is it porting from SFML 1.6 to SFML2?

-Sorry for this one =p Any benchmark for when SFML2 will be stable? =D

14
General discussions / SFML Cross-Platform Stability?
« on: November 06, 2010, 08:48:29 pm »
A little too low level for my tastes and it's Mac port is technically third party. I was using it actually and was porting my SFML framework to SDL but I was getting frustrated with how much lower leveled SDL is.

SFML's ease of use is one of the best I've ever run into.

what to do T_T

Laurent do you know if current SFML stable release runs ok on new Mac OS Lion?

15
General discussions / SFML Cross-Platform Stability?
« on: November 06, 2010, 08:19:01 pm »
I've used SFML in the past and fell in love with its simplicity and versatility but I'm concerned to move forward with building my own framework with it because I'm worried of Mac OS support not being solid enough.

The reason I want to use a framework is so I don't have to worry about what the framework does, I don't want to commit to using SFML if I'm going to have to play around with its insides to fix bugs for Mac every now and then.

Has anyone picked up the Mac OS port to ensure better future stability?

If not does anyone have any suggestions for a library with strong Win/Mac/Linux support that's similar to SFML?

My only alternative option right now is Allegro.





TL;DR.

Need high level C++ 2d graphics library with solid support for Win/Mac/Linux. Recommend please.

Pages: [1] 2
anything