I got blending working for all but subtract, which for some reason acts up and gives me a purple image, regardless of source or destination colors. For the others, it was just those 3 properties.
I have tried again and again to make it load the map without having to restart it. If you know how, I would love to know.
What do you mean by for later callback? It is not possible to generate the visual designer based on code, and I don't plan to implement it at this time.
If you are talking about my ftp server..
I rent a virtual server at https://www.hosteurope.de/
And use the installed Microsoft IIS ftp server. For the error reports and libraries, I wrote my own server side program.
I just have to set GraphicsDevice.RenderState.SourceBlend, GraphicsDevice.RenderState.DestinationBlend and GraphicsDevice.RenderState.BlendFunction to the right stuff.. There are some examples here http://forums.create.msdn.com/forums/p/75039/457237.aspx
It's not that much work.
Edit:
About multiple draw calls.. I read somewhere a while ago that for rendering the same thing many times, there is some way to get away with one draw call by sending an array of world matrices to directx, if I remember correctly. This was motivated by that this would be a lot cheaper than calling draw many times.
But it doesn't matter in this case. Performance is not an issue.
I am using the spritebatch to draw.. But rather than make multiple draw calls for different regions of the texture, I use the effect file to calculate what texture coordinate to use (for the different image types). First of all, this should be faster, simply because I get fewer draw calls, and I can push some arithmetic to the gpu. The speed gain probably isn't noticeable though, since the scene is so simple. Also, I think this solution is cleaner.. I have fewer variables to keep track of - just tex coord x and y. Otherwise, I would need rotation, source rectangle, destination rectangle and origin.
Some of my draw code:
foreach(Dialogdinitems){//A list of what should be rendered, in the order it should be renderedList<AbstractControl>renders=newList<AbstractControl>();renders.Add(d);//Each dialog has a list of controls, sorted after render priorityrenders.AddRange(d.ChildControls);while(renders.Count>0){AbstractControlitem=renders[0];renders.RemoveAt(0);//A single control might add more controls to render correctly, but theese controls//wont be in the output script. //An example is that the checkbox adds an image if it is set to be checked.renders.InsertRange(0,item.ExtraControlsToRender);if(item.DrawTexture){//Set image typeEffect.CurrentTechnique=Effect.Techniques[Enum.GetName(typeof(ImageType),item.ImageType)];//Clip rectangle used to clip controls when they are dragged outside of their parent dialogSpriteBatch.GraphicsDevice.RenderState.ScissorTestEnable=true;SpriteBatch.GraphicsDevice.ScissorRectangle=item.ClipRect;Texture2Dtexture=item.Texture??defaultTexture;//Buttons/check boxes have both pressed/not pressed images in same textureEffect.Parameters["RenderingButton"].SetValue(itemisButton||itemisCheckBox);Effect.Parameters["Tiled"].SetValue(item.IsTiled);Effect.Parameters["TintColor"].SetValue(item.Color.ToVector4());Effect.Parameters["TextureSize"].SetValue(newVector2(texture.Width,texture.Height));Effect.Parameters["TargetSize"].SetValue(newVector2(item.DrawRect.Width,item.DrawRect.Height));SpriteBatch.Begin(SpriteBlendMode.AlphaBlend,SpriteSortMode.Immediate,SaveStateMode.None);//Todo: Set blend functionEffect.Begin();Effect.CurrentTechnique.Passes[0].Begin();SpriteBatch.Draw(texture,item.DrawRect,null,Color.White);SpriteBatch.End();Effect.CurrentTechnique.Passes[0].End();Effect.End();}//Draw dialog titleif(itemisDialog){Dialogdialog=(Dialog)item;if(!string.IsNullOrEmpty(dialog.Title))DrawString(dialog.Title,dialog.TitleFontRect,dialog.TitleFont,Color.White);}//Draw the control's text if neededif(itemisDialogControl){DialogControlcontrol=(DialogControl)item;if(control.DrawText&&!string.IsNullOrEmpty(control.Text))DrawString(control.Text,control.DrawRect,control.TextStyle,control.TextColor);}}}
In case you're interested.. one of my shaders:
float4HorizontalBorderPS(float2texCoord:TEXCOORD0):COLOR{float2targetCoord=texCoord*TargetSize;float2edgeSize=float2(TextureSize.y,TextureSize.y);if(TargetSize.x<2*edgeSize.x)edgeSize.x=TargetSize.x/2;if(TargetSize.y<2*edgeSize.y)edgeSize.y=TargetSize.y/2;//First, we should check what region we are in.if(targetCoord.x<edgeSize.x){if(targetCoord.y<edgeSize.y){//Top lefttexCoord.x=targetCoord.x/(TextureSize.y*10);texCoord.y=targetCoord.y/TextureSize.y;}elseif(TargetSize.y-targetCoord.y<edgeSize.y){//Bottom lefttexCoord.x=targetCoord.x/(TextureSize.y*10)+0.2;texCoord.y=(targetCoord.y-TargetSize.y+TextureSize.y)/TextureSize.y;}else{//Left bordertexCoord.x=targetCoord.x/(TextureSize.y*10)+0.6;texCoord.y=((targetCoord.y-edgeSize.y)/TextureSize.y)%1;}}elseif(TargetSize.x-targetCoord.x<edgeSize.x){if(targetCoord.y<edgeSize.y){//Top righttexCoord.x=(targetCoord.x-TargetSize.x+TextureSize.y)/(TextureSize.y*10)+0.1;texCoord.y=targetCoord.y/TextureSize.y;}elseif(TargetSize.y-targetCoord.y<edgeSize.y){//Bottom righttexCoord.x=(targetCoord.x-TargetSize.x+TextureSize.y)/(TextureSize.y*10)+0.3;texCoord.y=(targetCoord.y-TargetSize.y+TextureSize.y)/TextureSize.y;}else{//Right bordertexCoord.x=(targetCoord.x-TargetSize.x+TextureSize.y)/(TextureSize.y*10)+0.7;texCoord.y=((targetCoord.y-edgeSize.y)/TextureSize.y)%1;}}else{if(targetCoord.y<edgeSize.y){//Top bordertexCoord.x=((targetCoord.x-edgeSize.x)/(TextureSize.y))%1;texCoord.y=targetCoord.y/TextureSize.y;//Need to rotatefloattemp=texCoord.x;texCoord.x=texCoord.y;texCoord.y=1-temp;//Ajust to regiontexCoord.x=texCoord.x/10+0.4;}elseif(TargetSize.y-targetCoord.y<edgeSize.y){//Bottom bordertexCoord.x=((targetCoord.x-edgeSize.x)/(TextureSize.y))%1;texCoord.y=(targetCoord.y-TargetSize.y+TextureSize.y)/TextureSize.y;//Need to rotatefloattemp=texCoord.x;texCoord.x=texCoord.y;texCoord.y=1-temp;//Ajust to regiontexCoord.x=texCoord.x/10+0.5;}else{//Middle filltexCoord.x=(((targetCoord.x-edgeSize.x)/TextureSize.y)%1)/10+0.8;texCoord.y=((targetCoord.y-edgeSize.y)/TextureSize.y)%1;}}if(RenderingButton)texCoord.y/=2;float4color=tex2D(ScreenS,texCoord);returncolor*TintColor;}
Your source says the uncompressed size. I doubt it's just the mapscript.galaxy file.. could just make that include a humongous script file, which would be a pretty easy workaround. Still.. it seems like kind of a silly limit.. Add Shakespeare's collected works in a comment, and you hit it with no code at all..
I can make the background be loaded from an image in the folder instead.
Hmm. I haven't experienced issues with the resizing. Is it because the boxes are too small? Do anyone else have this issue? Do you have exact steps to replicate the problem on a fresh dialog?
This might be counter intuitive, but when you place dialog items, you should hold the mouse down and drag them out to the desired size..
In a future version, I might set a default size if this is not done.
The other dialogs are attached to the main dialog, or whatever dialog you set to be their parent. In the output, you might see
You can do image processing just with the cpu, yes. But since the whole point of a graphics card is image processing, it has a lot of tools for it which you would have to write for the cpu yourself. And doing it with the gpu gives you a performance boost.
I quite like the idea of putting it in layout files, since it feels like that's where it belongs. I haven't toyed around with them much though.. Can you set values pr player and pr race? Are there anything you can do there, but not in script? Anyway, as for now, I will keep rolling with script, but once I get bugs and features sorted, I might look into it.
Well, the reason is that before xna 4.0 came out, I was working on a space game in xna (kindda like freelancer). When 4.0 came out, I looked into the changes to see if I wanted to port it to 4.0, and decided that I liked the way the coding was done in 3.1 better. So I guess it's just because i'm more used to 3.1 than 4.0. The fonts do annoy me, and I don't know how to fix it, but I'm also not guaranteed that it will look right in 4.0.
No. I couldn't find out where/if the stuff like buttons, checkboxes etc are defined in layout files, so it just mimics what it looks like in game. As for the output, that is galaxy script
Hmm. the front page stuff is really quite old.. I should probably rewrite it.. Right now, I can run statistic tools on downloads/accesses to the ftp server. Since the program checks there for new versions each time it is launched, it's a good source of info for me.
Edit:
Okay, it wasn't on the front page. Still - it's not a problem anymore.
Anyway, the background image is not the issue - added that because it's more interesting to look at than a flat color.. And in game, you would have a similar background.
From what mexa told me, it sounds to me like its an issue with shader versions.. but both yours and mexa's card should have no trouble with pixel shaders v 3.0....
The reason It looks to me that this is the issue is that all my shaders are for 3.0, except horizontal border, which is 2.0.. I'll release this, and we'll see if it works.
Hmm.... what graphics card do you have? Does it support v3.0 shaders? I had some trouble with too many operations for a v2.0 shader, so I just ramped up the required version.. but I could look into alternatives.
Yeah, adding support for extra image types should be fairly trivial, and I'll remove that useless option.
I already give you the option to set the target screen height, as I do in my video - which affects scale.
Edit:
I'll lower the required pixel shader version from 3.0 to 2.0a.. hope most people can run that.
0
I got blending working for all but subtract, which for some reason acts up and gives me a purple image, regardless of source or destination colors. For the others, it was just those 3 properties.
I have tried again and again to make it load the map without having to restart it. If you know how, I would love to know.
0
What do you mean by for later callback? It is not possible to generate the visual designer based on code, and I don't plan to implement it at this time.
0
If you are talking about my ftp server..
I rent a virtual server at https://www.hosteurope.de/
And use the installed Microsoft IIS ftp server. For the error reports and libraries, I wrote my own server side program.
0
I just have to set GraphicsDevice.RenderState.SourceBlend, GraphicsDevice.RenderState.DestinationBlend and GraphicsDevice.RenderState.BlendFunction to the right stuff.. There are some examples here http://forums.create.msdn.com/forums/p/75039/457237.aspx
It's not that much work.
Edit:
About multiple draw calls.. I read somewhere a while ago that for rendering the same thing many times, there is some way to get away with one draw call by sending an array of world matrices to directx, if I remember correctly. This was motivated by that this would be a lot cheaper than calling draw many times.
But it doesn't matter in this case. Performance is not an issue.
0
I am using the spritebatch to draw.. But rather than make multiple draw calls for different regions of the texture, I use the effect file to calculate what texture coordinate to use (for the different image types). First of all, this should be faster, simply because I get fewer draw calls, and I can push some arithmetic to the gpu. The speed gain probably isn't noticeable though, since the scene is so simple. Also, I think this solution is cleaner.. I have fewer variables to keep track of - just tex coord x and y. Otherwise, I would need rotation, source rectangle, destination rectangle and origin.
Some of my draw code:
In case you're interested.. one of my shaders:
0
Your source says the uncompressed size. I doubt it's just the mapscript.galaxy file.. could just make that include a humongous script file, which would be a pretty easy workaround. Still.. it seems like kind of a silly limit.. Add Shakespeare's collected works in a comment, and you hit it with no code at all..
0
@SouLCarveRR: Go
I can make the background be loaded from an image in the folder instead.
Hmm. I haven't experienced issues with the resizing. Is it because the boxes are too small? Do anyone else have this issue? Do you have exact steps to replicate the problem on a fresh dialog?
This might be counter intuitive, but when you place dialog items, you should hold the mouse down and drag them out to the desired size..
In a future version, I might set a default size if this is not done.
The other dialogs are attached to the main dialog, or whatever dialog you set to be their parent. In the output, you might see
When you add a child dialog.
You can do image processing just with the cpu, yes. But since the whole point of a graphics card is image processing, it has a lot of tools for it which you would have to write for the cpu yourself. And doing it with the gpu gives you a performance boost.
@FuzzYD: Go
Okay.. any idea how many lines we are talking about?
@Kalekin: Go
I quite like the idea of putting it in layout files, since it feels like that's where it belongs. I haven't toyed around with them much though.. Can you set values pr player and pr race? Are there anything you can do there, but not in script? Anyway, as for now, I will keep rolling with script, but once I get bugs and features sorted, I might look into it.
0
Well, the reason is that before xna 4.0 came out, I was working on a space game in xna (kindda like freelancer). When 4.0 came out, I looked into the changes to see if I wanted to port it to 4.0, and decided that I liked the way the coding was done in 3.1 better. So I guess it's just because i'm more used to 3.1 than 4.0. The fonts do annoy me, and I don't know how to fix it, but I'm also not guaranteed that it will look right in 4.0.
0
@SouLCarveRR: Go
Okay.. that's the directory.. Just delete it.. Ill fix the updater for next version.
@Kalekin: Go
No. I couldn't find out where/if the stuff like buttons, checkboxes etc are defined in layout files, so it just mimics what it looks like in game. As for the output, that is galaxy script
@SouLCarveRR: Go
If you import the custom images to your map, you should be able to select them from the list.
0
Hmm. the front page stuff is really quite old.. I should probably rewrite it.. Right now, I can run statistic tools on downloads/accesses to the ftp server. Since the program checks there for new versions each time it is launched, it's a good source of info for me.
Edit:
Okay, it wasn't on the front page. Still - it's not a problem anymore.
0
I uploaded a new version.
Anyway, the background image is not the issue - added that because it's more interesting to look at than a flat color.. And in game, you would have a similar background.
From what mexa told me, it sounds to me like its an issue with shader versions.. but both yours and mexa's card should have no trouble with pixel shaders v 3.0....
0
As a AAA game company would say, "We are aware of this issue, and are currently working on a solution" :) I'll upload a new version momentarily.
Just out of curiosity.. what graphics card do you have?
0
The reason It looks to me that this is the issue is that all my shaders are for 3.0, except horizontal border, which is 2.0.. I'll release this, and we'll see if it works.
0
I put a refference to it in the top post ;)
You will find the latest version here
ftp://46.163.69.112/Releases/
0
Hmm.... what graphics card do you have? Does it support v3.0 shaders? I had some trouble with too many operations for a v2.0 shader, so I just ramped up the required version.. but I could look into alternatives.
Yeah, adding support for extra image types should be fairly trivial, and I'll remove that useless option.
I already give you the option to set the target screen height, as I do in my video - which affects scale.
Edit:
I'll lower the required pixel shader version from 3.0 to 2.0a.. hope most people can run that.