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

Pages: [1]
1
Graphics / Re: How can i propper rezise my Background Image
« on: July 15, 2014, 08:47:53 am »
Thanks for quick reply. i will try. But i seems im not able to Transform my Sprite, not sure what im doing wrong but my Sprite not Change after transform as you see in my Debug Step.


2
Graphics / How can i propper rezise my Background Image
« on: July 15, 2014, 07:47:51 am »
Good Morning Guy's,

i have a Problem i try to set my Background Image exactly too my Window Resolultion.

My Image Size is 1920,1080:

If i run the Game with a Desktop Resolution 1920,1080 everything is perfectly centered.

If i run now the Game with a Desktop Resolution 1600,900 the Image is always off and not centered i did try Transform, Scale everything i dont get centered im sure i do something wrong but it would be nice if you could give me a hint. (BTW. I use SFML.NET)


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using SFML.Window;
using SFML.Graphics;
using SFML.Audio;

namespace BushRaider64
{
    class BushRaider
    {
        //ScreenManager und Render Window

        private ScreenManager screenManager;
        public RenderWindow renderWindow;
        private Sprite background;
        private SpriteFactory spriteFactory;

        //Camera

        View view;

        //GameTime

        private const double frames = 60;
        private const double timeStep = 1 / frames;
        private double timeBank;
        private Stopwatch timer;
        private TimeSpan deltaTime;

        public BushRaider()
        {
            //Window Initialisieren

            VideoMode video = new VideoMode();
            video = VideoMode.DesktopMode;

            //Debug Code

            foreach(VideoMode item in VideoMode.FullscreenModes)
            {
                Console.WriteLine(item.Width + " + " + item.Height + " + " + item.BitsPerPixel);
            }
            Console.WriteLine(VideoMode.DesktopMode.Width + " + " + VideoMode.DesktopMode.Height );


            renderWindow = new RenderWindow(video, "BushRaider",Styles.Default);
            renderWindow.SetVisible(true);
            renderWindow.SetVerticalSyncEnabled(true);
            renderWindow.Closed += new EventHandler(onClosed);

            //Test Sprite

            spriteFactory = new SpriteFactory();
            background = spriteFactory.createSprite(new IntRect(0, 0, (int)video.Width, (int)video.Height), "GameAssets/logo.png");


            //GameTime Initialisieren

            timer = new Stopwatch();
            deltaTime = new TimeSpan();
            timer.Start();

            //Camera

            view = new View(new FloatRect(0, 0, VideoMode.DesktopMode.Width, VideoMode.DesktopMode.Height));
            renderWindow.SetView(view);

            this.Update();

        }

        public void Update()
        {
            while(renderWindow.IsOpen())
            {
                timeBank += deltaTime.TotalSeconds;

                if (timeBank >= timeStep)
                {
                    timeBank -= timeStep;
                }

                renderWindow.DispatchEvents();
                this.Draw();
                renderWindow.Display();

                deltaTime = timer.Elapsed;
                timer.Restart();
            }
        }

        public void Draw()
        {
            renderWindow.Clear(Color.Blue);
            renderWindow.Draw(background);
        }

        public void onClosed(Object sender, EventArgs e)
        {
            renderWindow.Close();
        }
    }
}
 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SFML.Window;
using SFML.Graphics;
using SFML.Audio;

namespace BushRaider64
{
    class SpriteFactory
    {
        public Sprite createSprite(IntRect rectangle, string fileName)
        {
            Texture texture = new Texture(fileName, rectangle);
            return new Sprite(texture, rectangle);
        }
    }
}
 

Thanks in Advance

Dolphin

3
General / Re: Fixed TimeStep 1 Core nearly 100 %
« on: July 14, 2014, 11:04:00 am »
Then it might be a cheap/bad implementation of VSync in your driver. To get zero latency they sometimes using a spinlock or something like that, which will make out the CPU, but they then can at least guarantee proper VSync.

With "Fixed TimeStep" in your title, are you trying to fix your frame time with VSync, so you get a fixed timestep for your logic, or were you actually talking about fixed timestep?
If it was the first, then stop now. You should not try to fix your frame time and then use it for your calculations. Always assume that the frametime will be jumping, as such you might want to look at the link above.
If you actually meant what is mentioned in the linked article, then there's no reason in requiring VSync at all cost. Your logic will already be independent of whatever your frame time does.

Very very strange, i have a up to date NVIDA Driver, and yes i try the second one may i have a mistake in my Code? But it seems too work.

Unfornatly i dont have any Content in my Project so i can't test if this will cause later Stutter with more Content and AI Calculation's and Stuff.

Greetings

Dolphin

4
General / Re: Fixed TimeStep 1 Core nearly 100 %
« on: July 14, 2014, 10:46:45 am »
Thanks for the quick reply,

i did change now my NVIDA Setting's to forced on and let the program decide. With VSYNC on my Program still use the Full Core.

Greetings

WhySoSad

5
General / Fixed TimeStep 1 Core nearly 100 %
« on: July 14, 2014, 10:12:35 am »
Dear Lady's and Gentlemen,

i have a Problem, i try to get a Fixed Timestep Loop running. I got it so far that it now has the same Framerate on 60 or 99999(and everything between).

If i use VSYNC the Programm need a whole Core to run this simple Program. --> http://snag.gy/kADOW.jpg

BUT

If i use SetMaxFrameRate(60) i use just 1 - 3 % of my CPU --> http://snag.gy/byQlA.jpg

Can somebody please tell me where is the Problem of my Code?

http://pastebin.com/5XtkgJDC

(click to show/hide)

Greetings

Dolphin

6
General discussions / Some Question's about SFML
« on: July 07, 2014, 03:02:33 pm »
Dear Lady's and Gentlemen,

i am very new too Programming and i currently work with C# and XNA / Monogame.

I have some Question's about SFML, can i use SFML efficient with C# as Main Language or will i miss some Features / encounter more Bug's / Performance Issue?

Are there any real Product's that are createt with this Combination? (You may have Project links?)

Do i find Tutorial's for this or will it be hard to get into it?

Thanks for reading hope you can help me  :)

Greetings

Dolphin

Pages: [1]