C++ :: SFML - Relative Position In Different Sized Windows

Apr 27, 2013

Is there any way in sfml version 2 that I can get objects in a graphics window to retain there relative positions and sizes when the window is resized? I have tried looking in the documentation for version 2 but with no luck.

As an example suppose the window is 800x600 and there is a line running right across the window at 3/4 of the way down (i.e at y=450). If the window is then made larger say 1280x1024 how would I keep the line in the same relative position (i.e all the way across 1280 and 3/4 of the y setting down).

View 3 Replies


ADVERTISEMENT

Visual C++ :: Reading Character Symbols On Lines Of Text Position By Position?

Mar 4, 2013

What I have to do is write a small program in C++ to parse the symbols that are used on 5 different lines of text in each position until position 30 is reached on each line. The goal of the parsing program is to interpret the symbols (characters), if there are any per each position, on the 5 lines of text in order to output the actual data that the group of symbols represents.

My question for is this: Is there anything special from a C++ environment that should go in to something like this outside of using standard stuff like the math associated with the search algorithm that has to happen here? The symbols are located in a file, so I know I have to include "iostream" and a few other headers. But outside of header inclusions and the code necessary to iterate and streamline the search and interpretation process, am I missing anything special that I couldn't otherwise find through simple google searches?

View 6 Replies View Related

C++ :: Inputting Into Double-sized Vector Freezes?

Mar 27, 2013

Whenever the code reaches:

matrix[atoi(tmp[1].c_str())][atoi(tmp[2].c_str())] = strtod(tmp[3].c_str(), NULL);

The app just blocks. Could it be due to a lack of RAM (since its inside a massive loop and I'm currently using an old-ass pc with 1GB RAM) or is it bad programming? If I remove that line everything runs smoothly.

View 7 Replies View Related

C++ :: Error / Variable-sized Object (largeArray2) May Not Be Initialized

Feb 28, 2013

when i compile my code i get this error : "error : variable-sized object 'largeArray2' may not be initialized"

Code:

float give_coefficients_routh_table_and_fill_two_first_lines(int denominator_degree)
{
float largeArray2[20][20] = {0};
int l = 0;
int c = 0;
int e = denominator_degree ;
for ( e = denominator_degree; e>=0; e--)

[Code] .....

View 9 Replies View Related

C :: Multidimensional Arrays - Variable Sized Object Maybe Not Be Initialized?

Oct 30, 2013

I'm trying to get a full understanding of multidimensional arrays. When I try to initialize the array I get an error.

Code:

int Pick2(void) {
int pick = 2;
int limit = 0;

[Code].....

The error I get is "variable-sized object maybe not be initialized" with warnings messages pertaining the that Error message.

View 12 Replies View Related

Visual C++ :: Drawing (radius Sized) Lines From Center To Boundary Of Circle

Feb 3, 2014

I am facing a programming logic problem. I want to draw radius sized lines from centre of circle to the circle boundary.

My code is:

int x1, y1, x2, y2, i, r, old_xc,old_yc, x,y;
int xc, yc;
x1=170;
y1=300;
x2=70;
y2=400;
pDC->Ellipse(x1,y1,x2,y2);

[Code] .....

The lines are touching the circle boudary at only start while the rest of lines are smaller and the shape is a triangle instead of a pie slice.

View 8 Replies View Related

C++ :: Changing Relative Path Reference?

Sep 3, 2014

FILE* pFile = fopen ("./myfile.txt","w+");

Is there a way to change what a relative path is referencing after runtime has started?

My specific issue is that I have several existing 100,000+ LOC lua projects. I am building a new back-end in C/C++ for this by wrapping a Lua C library. The lua scripts use io.open("./path/relative/to/project/file") which translates to fopen(...) in C. The project file which this is relative to is opened by the user after the application has started.

I see two solutions, neither are particularly good:

1) Change every io.open() function in every project to be relative to a static location. I lose all flexibility if I do this.

2) Modify the Lua library to prepend a custom path to opened files. Modifying 3rd party libraries suck because you can't update the library without tracking patches.

3?) Ask cplusplus forum if there is a way to change the relative directory.

View 4 Replies View Related

C# :: Connection String With Relative Path

Jun 3, 2014

I have my application database in the AppDataRoaming folder. I'm trying to create a connection string for Telerik reporting, up until now I've had a connection string in a settings class that is put together like this:

The path is:

data source=C:UsersSynlightAppDataRoamingAppNamedataAppDB.sqlite

I've tried files paths like this:

%AppData%RoamingAppDatadataAppDB.sqlite

and

Server.MapPath(@"~App_DataRoamingAppDatadataAppDB.sqlite

(those are not the real directory names, of course). How do I create a connection string that will work on target machines?

View 5 Replies View Related

C++ ::  How To Get Relative Address Of Member Of Class Of Struct

Apr 2, 2014

How to get relative memory address of members of Class or Structure ? I want to auto scan the members of Class/Struct, and show the address/value like the "watch window" in debug mode of popular C/C++ IDE software.

View 2 Replies View Related

Visual C++ :: Cannot Find Relative Header File

Sep 22, 2014

For a while, I have been running a Windows 7 Visual Studio 2012 CPP project fine. However, today, all of a sudden, it has stopped being able to read any header files that are in relative directories. I cannot think what I have done to make this happen.

It seems to be an issue with Visual Studio as a whole, rather than my individual project, because I have created a new simple project and I am having the same problem. So, I have a CPP project at `C:/Projects/TestProject`. Then, I have a header file called `test_header.hpp`, which is located at `C:/Headers`. In `TestProject`'s project settings, I have added the directory `../../Headers` to `Additional Include Directories`. Then, my main functions is as follows:

Code:
#include "test_header.hpp"
int main() {
return 0;
}

Which gives me the error:

Code:
Error1error C1083: Cannot open include file: 'test.hpp': No such file or directoryc:projects estprojectmain.cpp11TestProject

Is there some global Visual Studio setting that is responsible for setting up these relative directories? Just in case the relative directory was not correct, I also tried a load of others, such as `../Headers` and `../../../Headers`, but these gave the same errors.

View 1 Replies View Related

C++ :: Open File For Writing Relative Path Given On Runtime

May 18, 2014

How it make it work for my project. Runtime means I am going to have to give the path at the command line?

Here is how I have to run it, so I can test it against the example inputs and outputs they give us to test our program. I am using putty. Already crated the folders inside my project folder, but don't know how to implement it on my source code.

./movie_stats < ./input/test1.in ./my-output/test1.out

What I'm thinking is to open/create the file test1.out in the my-output folder and open it at runtime?

View 1 Replies View Related

C++ :: Non-static Member Reference Must Be Made Relative To A Specific Object

Mar 4, 2012

Code:
class A
{
std::map<std::string, Unit*> aMap;
class B

[Code] .....

This code snippet results in "A non-static member reference must be made relative to a specific object". When I make callA() static, this error goes away, but there is problem with aMap.

View 2 Replies View Related

C++ :: Creating Game Using SFML

Apr 26, 2014

I'm currently working on a 2D space shooter game in C++ using SFML library. What I need to know is how make an object (ex:laser) fire up from object (ex:player) when a user press button??

View 1 Replies View Related

C++ ::  SFML - How To Put Graphics Into Program

Oct 18, 2013

I use visual studio 2012. When I asked what I should use in order to put graphics into my program, I was told by the community that SFML works well. My only problem is that now I have SFML, where and how do I unpack it?

View 6 Replies View Related

C++ :: SFML 2.0 - Change Cursor

Sep 4, 2013

How to change what the cursor is in sfml 2.0?

View 1 Replies View Related

C++ :: Blinking Cursor In SFML?

Oct 22, 2013

so im trying to make a blinking cursor to give it a terminal feel, but it is speradic, since it is going at cycles instead of seconds. how can i fix this?

#include <SFML/Graphics.hpp>
int main() {
sf::RenderWindow App(sf::VideoMode(900, 750), "Fuck it. Uploads Happen.");
sf::Font
Font;

[Code].....

View 14 Replies View Related

C++ :: Tiled Map Loader For SFML

Jun 14, 2013

So I have the following code using [URL] ..... It compiles correctly, but does not display the map on the screen. Is it an issue with my code or an issue with the map file itself?

#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <level.h>
int main(){
sf::RenderWindow window(sf::VideoMode(640, 480), "");

[Code] ....

View 1 Replies View Related

C++ :: Blinking Window In SFML

May 16, 2013

using SFML in visual studio 2012 ... this code gives blinking window.

#include<iostream>
#include<SFMLGraphics.hpp>
using namespace std;
sf::RenderWindow window (sf::VideoMode(800,600),"GAME");

[Code]....

View 8 Replies View Related

C++ :: Red Black Tree - SFML

May 17, 2014

How to make a red and black tree using SFML ....because i really need...I really don't know how to use SFML i only know how to use win32 console.

View 3 Replies View Related

C++ :: SFML 2.0 Changing Alpha?

Sep 18, 2013

I want to change the alpha of a sprite without changing any other colours

View 4 Replies View Related

C++ :: Getting Sprite To Animate With SFML

Dec 10, 2013

So this is my first try animating on my own, without a reference right in front of me. It's not working, I did check some of the projects I've made in the past, but for one those were done with Allegro, and really it should be able to move over to SFML quite easily, but it's not. It does display on the window in the correct place, but there are 3 pictures in the file and I want it to cycle through them, but it shows all three at the same time, and it only works once. if I press space a second time, only one of the pictures shows up, and it doesn't cycle at all. Here is my .cpp file :

#include "headers.h"
#include "SwordSprite.h"
int top = 0;
int left = 88;
int right = 132;
int bottom = 35;
SwordSprite::SwordSprite() {

[Code] .....

View 2 Replies View Related

C++ :: Setting Up SFML With Eclipse CDT

Aug 12, 2013

I am having trouble setting up SFML 2.1 to run with the eclipse IDE for c++ development. I use MinGW for my compiler.

When I link my include folder, lib folder and dll's it will not run a simple SFML program.

View 2 Replies View Related

C++ :: SFML And OGL That Should Display A Rotatable Cube

Nov 26, 2013

I wrote some Code with SFML c++ and OGL that should display a rotatable Cube ....... it doesnt .. WHY?

#include<SFML/OpenGL.hpp>
#include<SFML/Graphics.hpp>
#include<iostream>
void display();
void specialKeys();

[code]....

View 4 Replies View Related

C++ :: SFML 2.0 Pixel Perfect Collision

Oct 15, 2013

I have the code and it compiles fine but it doesn't work. (i am using the coding made easy sfml 2.0 tutorials)

Code:

#include <SFML/Graphics.hpp>
#include <iostream>
#include <algorithm>
#include <vector>
class Player {
public:
sf::Sprite player;

[Code] ....

View 18 Replies View Related

C++ :: SFML 2.0 - Text Scrolling On Screen

Sep 19, 2013

I have screen scrolling working but i want to have text scroll with the screen. because at the moment my player moves and the screen scrolls but the text doesn't.

View 15 Replies View Related

C++ :: SFML Window Title Bar Font

May 7, 2013

Any way in sfml of changing the font style and/or size used in the window title for RenderWindow?

As a secondary point - can the colour and size of the title bar itself be changed?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved