Daily Archives

Articles indexed Tuesday May 18 2010

Page 6/121 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Using Effect For Fog of War

    - by Qua
    I'm trying to apply fog of war to areas on the screen not currently visible to the player. I do this by rendering the game content in one RenderTarget and the the fog of war into another, and then I merge them with an effect file that takes the color from the game RenderTarget and the alpha from the fog of war render target. The FOW RenderTarget is black where the FOW appears, and white where it doesn't. This does work, but it colors the fog of war (the unrevealed locations) white instead of the intended color of black. Before applying the effect I clear the backbuffer of the device to white. When I try to clear it to black, non of the fog of war appears at all, which I assume is a product of alpha blending with black. It works for all other colors, however - giving the resulting screen a tint of that color. How do I archieve a black fog while still being able to do alpha blending between the two render targets? The rendering code for applying the FOW: private RenderTarget2D mainTarget; private RenderTarget2D lightTarget; private void CombineRenderTargetsAndDraw() { batch.GraphicsDevice.SetRenderTarget(null); batch.GraphicsDevice.Clear(Color.White); fogOfWar.Parameters["LightsTexture"].SetValue(lightTarget); batch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); fogOfWar.CurrentTechnique.Passes[0].Apply(); batch.Draw( mainTarget, new Rectangle(0, 0, batch.GraphicsDevice.PresentationParameters.BackBufferWidth, batch.GraphicsDevice.PresentationParameters.BackBufferHeight), Color.White ); batch.End(); } The effect file I'm using to apply the FOW: texture LightsTexture; sampler ColorSampler : register(s0); sampler LightsSampler = sampler_state{ Texture = <LightsTexture>; }; struct VertexShaderOutput { float4 Position : POSITION0; float2 TexCoord : TEXCOORD0; }; float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 { float2 tex = input.TexCoord; float4 color = tex2D(ColorSampler, tex); float4 alpha = tex2D(LightsSampler, tex); return float4(color.r, color.g, color.b, alpha.r); } technique Technique1 { pass Pass1 { PixelShader = compile ps_2_0 PixelShaderFunction(); } }

    Read the article

  • xcode - iPad App. Status bar overlaps toolBar.

    - by Aakburns
    I have an app fully finished. It is very simple. Uses a toolBar up top with a few buttons. Under this is a WebView. The WebView only opens one URL and there is no way to get away from this site. Thats the point of it. Now the issue. The status bar overlaps the toolBar. My temp solve is to hide the status bar, but I really need it to be there in this app. I'm not sure what the problem is. I'm fairly new to this. Thanks for any help.

    Read the article

  • Display hidden li based on class

    - by kylex
    I have the following list structure: <ul> <li>One</li> <li>Two <ul> <li class="active">Two-1</li> <li>Two-2</li> </ul> </li> <li>Three <ul> <li>Three-1</li> </ul> </li> </ul> with the following CSS: ul li ul{ display:none; } ul li:hover ul{ display:block; } What I would like is this: When an li class is active, the entire structure down until the active class gets displayed. so in the case provided the following would show, along with the top level: One Two Two-1 Two-2 Three I'd like either a CSS or jQuery implementation (or mixture of the two) if possible.

    Read the article

  • Building static nav in concrete5

    - by hollyb
    I've inherited a site built with the CMS concrete5. I'm just starting to dissect it but was hit with a wicked short deadline on a complete overhaul to the nav. So, I want to build out a static nav and then go back when I have more time and integrate it with the auto-nav. Does anybody have experience working with concrete5? If so: Where would I drop my custom static nav? Is it possible to select it from the admin (so that the current one is still available if the client wants to switch back via the admin)? Thanks!

    Read the article

  • Converting a String to Color in Java

    - by devoured elysium
    In .NET you can achieve something like this: Color yellowColor = Color.FromName("yellow"); Is there a way of doing this in Java without having to resort to reflection? PS: I am not asking for alternative ways of storing/loading colors. I just want to know wherever it is possible to do this or not.

    Read the article

  • Upload two files at once

    - by Keyo
    I am trying to upload two files at once (two file fields) with codeigniters upload class. Despite having provided the field name codeigniter produces errors on the second field. I this a limitation of codeigniter, php or html or am I simply using the class incorectly? $this->upload->do_upload('video_file') $this->upload->do_upload('image_file') Produces this on the image field: The filetype you are attempting to upload is not allowed. Here are my two functions function upload_image() { $thumb_size = 94; $config['upload_path'] = './assets/uploads/images/'; $config['allowed_types'] = 'jpg|png|gif'; $config['max_size'] = '2048'; $config['file_name'] = 'video_' . rand(999999, 999999999); $this->load->library('upload', $config); if (!$this->upload->do_upload('image_file')) { $error = array('error' => $this->upload->display_errors()); return $error; } else { function upload_video() { $config['upload_path'] = './assets/uploads/videos/'; $config['allowed_types'] = 'flv'; $config['max_size'] = '0'; $config['file_name'] = 'video_' . rand(999999, 999999999); $this->load->library('upload', $config); if (!$this->upload->do_upload('video_file')) { $error = array('error' => $this->upload->display_errors()); return $error; } else {

    Read the article

  • How to implement facebook like button

    - by vamsivanka
    I am trying to implement facebook like button on my website. The first four lines in the code is already there on my site after the end of the "" tag. To implement the "Like button" i have added the second script (Line five to the end) and ran the application. Its giving me an error as "Microsoft Jscript runtime error:'_onLoad' is null or not an object" Please Let me know. Thanks <script type="text/javascript" src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php"></script> <script type="text/javascript"> FB.init("myapikey", "xd_receiver.htm", { "reloadIfSessionStateChanged": true }); </script> <script type="text/javascript"> window.fbAsyncInit = function() { FB.init({appId: 'myappid', status: true, cookie: true, xfbml: true}); }; (function() { var e = document.createElement('script'); e.async = true; e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; document.getElementById('fb-root').appendChild(e); }()); </script> References: http://developers.facebook.com/docs/reference/plugins/like <fb:like href="http://webclip.in" layout="standard" show-faces="true" width="450" action="like" font="arial" colorscheme="light"/>

    Read the article

  • SELECT INTO statement in sqlite.

    - by monish
    HI Guys, Here I a wanna know that whether sqlite supports SELECT INTO statement. Actually I am trying to save the data in my table1 into table2 as a backup of my database before modifying the data. for that when I am using the SELECT INTO Statement a syntax error was generating as: My query as: SELECT * INTO equipments_backup FROM equipments; "Last Error Message:near "INTO":syntax error". Anyone's help will be appreciated. Thank you, Monish.

    Read the article

  • How do I change the CellErrorStyle for an Xceed Datagrid?

    - by Bob
    So in the Xceed documentation there is a code example that does not work for me. It may be because my grid is bound to a DataGridCollectionView. The objects in the collection used by the datagridcollection are what implement IDataErrorInfo. The errors are showing up just fine. The problem is that they are using the default orange background for errors...I need a red border. Below is the XAML instantiation of my grid. I set the DataCell background property to red just so I could be sure I had access to the grid's properties... I do. I just can't find the way to identify the cell's w/ errors so I can style them. Thanks! <XceedDG:DataGridControl Grid.Row="1" Grid.ColumnSpan="5" ItemsSource="{Binding Path = ABGDataGridCollectionView, UpdateSourceTrigger=PropertyChanged}" Background="{x:Static Views:DataGridControlBackgroundBrushes.ElementalBlue}" IsDeleteCommandEnabled="True" FontSize="16" AutoCreateColumns="False" x:Name="EncounterDataGrid" AllowDrop="True"> <XceedDG:DataGridControl.View> <Views:TableView ColumnStretchMode="All" ShowRowSelectorPane="True" ColumnStretchMinWidth="100"> <Views:TableView.FixedHeaders> <DataTemplate> <XceedDG:InsertionRow Height="40"/> </DataTemplate> </Views:TableView.FixedHeaders> </Views:TableView> </XceedDG:DataGridControl.View> <!--Group Header formatting--> <XceedDG:DataGridControl.Resources> <Style TargetType="{x:Type XceedDG:GroupByControl}"> <Setter Property="Visibility" Value="Collapsed"/> </Style> <Style TargetType="{x:Type XceedDG:DataCell}"> <Setter Property="Background" Value="Red"/> </Style> </XceedDG:DataGridControl.Resources> ...

    Read the article

  • How can I define a clojure type that implements the servlet interface?

    - by Rob Lachlan
    I'm attempting to use deftype (from the bleeding-edge clojure 1.2 branch) to create a java class that implements the java Servlet interface. I would expect the code below to compile (even though it's not very useful). (ns foo [:import [javax.servlet Servlet ServletRequest ServletResponse]]) (deftype servlet [] javax.servlet.Servlet (service [this #^javax.servlet.ServletRequest request #^javax.servlet.ServletResponse response] nil)) But it doesn't compile. The compiler produces the message: Mismatched return type: service, expected: void, had: java.lang.Object [Thrown class java.lang.IllegalArgumentException] Which doesn't make sense to me, because I'm returning nil. So the fact that the return type of the method is void shouldn't be a problem. For instance, for the java.util.Set interface: (deftype bar [#^Number n] java.util.Set (clear [this] nil)) compiles without issue. So what am I doing wrong with the Servlet interface? To be clear: I know that the typical case is to subclass one of the servlet abstract classes rather than implement this interface directly, but it should still be possible to do this. Stack Trace: The stack trace for the (deftype servlet... is: Mismatched return type: service, expected: void, had: java.lang.Object [Thrown class java.lang.IllegalArgumentException] Restarts: 0: [ABORT] Return to SLIME's top level. Backtrace: 0: clojure.lang.Compiler$NewInstanceMethod.parse(Compiler.java:6461) 1: clojure.lang.Compiler$NewInstanceExpr.build(Compiler.java:6119) 2: clojure.lang.Compiler$NewInstanceExpr$DeftypeParser.parse(Compiler.java:6003) 3: clojure.lang.Compiler.analyzeSeq(Compiler.java:5289) 4: clojure.lang.Compiler.analyze(Compiler.java:5110) 5: clojure.lang.Compiler.analyze(Compiler.java:5071) 6: clojure.lang.Compiler.eval(Compiler.java:5347) 7: clojure.lang.Compiler.eval(Compiler.java:5334) 8: clojure.lang.Compiler.eval(Compiler.java:5311) 9: clojure.core$eval__4350.invoke(core.clj:2364) 10: swank.commands.basic$eval_region__673.invoke(basic.clj:40) 11: swank.commands.basic$eval_region__673.invoke(basic.clj:31) 12: swank.commands.basic$eval__686$listener_eval__687.invoke(basic.clj:54) 13: clojure.lang.Var.invoke(Var.java:365) 14: foo$eval__2285.invoke(NO_SOURCE_FILE) 15: clojure.lang.Compiler.eval(Compiler.java:5343) 16: clojure.lang.Compiler.eval(Compiler.java:5311) 17: clojure.core$eval__4350.invoke(core.clj:2364) 18: swank.core$eval_in_emacs_package__320.invoke(core.clj:59) 19: swank.core$eval_for_emacs__383.invoke(core.clj:128) 20: clojure.lang.Var.invoke(Var.java:373) 21: clojure.lang.AFn.applyToHelper(AFn.java:169) 22: clojure.lang.Var.applyTo(Var.java:482) 23: clojure.core$apply__3776.invoke(core.clj:535) 24: swank.core$eval_from_control__322.invoke(core.clj:66) 25: swank.core$eval_loop__324.invoke(core.clj:71) 26: swank.core$spawn_repl_thread__434$fn__464$fn__465.invoke(core.clj:183) 27: clojure.lang.AFn.applyToHelper(AFn.java:159) 28: clojure.lang.AFn.applyTo(AFn.java:151) 29: clojure.core$apply__3776.invoke(core.clj:535) 30: swank.core$spawn_repl_thread__434$fn__464.doInvoke(core.clj:180) 31: clojure.lang.RestFn.invoke(RestFn.java:398) 32: clojure.lang.AFn.run(AFn.java:24) 33: java.lang.Thread.run(Thread.java:637)

    Read the article

  • Can I get an example please?

    - by Doug
    $starcraft = array( "drone" => array( "cost" => "6_0-", "gas" => "192", "minerals" => "33", "attack" => "123", ) "zealot" => array( "cost" => "5_0-", "gas" => "112", "minerals" => "21", "attack" => "321", ) ) I'm playing with oop and I want to display the information in this array using a class, but I don't know how to construct the class to display it. This is what I have so far, and I don't know where to go from here. Am I supposed to use setters and getters? class gamesInfo($game) { $unitname; $cost; $gas; $minerals; $attack; }

    Read the article

  • Workshops tackle Qt, Linux, and i.MX development

    <b>LinuxDevices:</b> "Future Electronics and Nokia will host six full-day, hands-on workshops across the North America on using Linux and Nokia's Qt development framework to develop user interfaces (UIs) for Freescale's ARM-based i.MX system-on-chips (SoCs)."

    Read the article

  • Microsoft turning into a toothless tiger?

    <b>Technology & Life Integrationt:</b> "Many moons ago ( and I am not talking about those drunken moons at passing cars :), while the IT jungle was still fresh and green. There was a big blue king of the jungle. This top monkey position was usurped by an up and coming tiger that, while the tigers name seemed small and soft, it wasn't afraid to show its teeth."

    Read the article

  • A Quantity class with units

    - by Ryan Ohs
    Goals Create a class that associates a numeric quantity with a unit of measurement. Provide support for simple arithmetic and comparison operations. Implementation An immutable class (Could have been struct but I may try inheritance later) Unit is stored in an enumeration Supported operations: Addition w/ like units Subtraction w/ like units Multiplication by scalar Division by scalar Modulus by scalar Equals() >, >=, <, <=, == IComparable ToString() Implicit cast to Decimal The Source The souce can be downloaded from Github. Notes This class does not support any arithmetic that would modify the unit. This class is not suitable for manipulating currencies. Future Ideas Have a CompositeQuantity class that would allow quantities with unlike units to be combined. Similar currency class with support for allocations/distributions. Provide conversion between units. (Actually I think this would be best placed in an external service. Many situations I deal with require some sort of dynamic conversion ratio.)

    Read the article

  • wamp can't put offline!!

    - by user343570
    when i wana put it offline it say: "Could not execute menu item (internal error) [Exception] Could not perform service action: The service has not been started." all froums said to me:u must under Apache open the httpd.conf and change the lines #Listen 12.34.56.78:80 Listen 80 to #Listen 12.34.56.78:80 Listen 8080 save the file and you are done. but my httpd.conf is blank!!!i need it

    Read the article

  • Why would my wireless cut in and out every minute or so?

    - by Strilanc
    I've been having problems with my wireless. I moved to a new apartment, and the wireless seems incredibly unreliable. Sometimes it will be stable for hours until, all of a sudden, it starts cutting in and out. I'll get 30-90 seconds of normal behavior, then 5-30 seconds of nothing, then repeat. Sometimes the connection will stop working entirely, until I power-cycle the router. It is extremely, extremely annoying. Surfing the web isn't too bad, assuming you can stand the random 5-30 second waits. But some connections are sensitive enough to timeout, and it certainly makes multiplayer games unplayable. Facts: I confirmed the problem using ping google.com -t. I get normal traffic, interspersed with bursts of "Request timed out.". I've never had this problem before with this laptop. I didn't bring my own router or modem to the apartment. I'm using what the old tenant had. Hooking directly to the modem via an ethernet cable results in a stable connection. Temporarily cutting power to the router sometimes fixes the problem. Sometimes it doesn't. I reset the router, but the problem remained. Apparently the previous tenant had issues with the internet, but I don't know what they were specifically. The router is a D-Link DIR-615, and their tech support is useless.

    Read the article

  • Windows and file system abstraction - how much does it matter where something comes from?

    - by deceze
    I have come across the following phenomenon and would like to know how leaky Windows' file system abstraction is or if there's something else involved. I partitioned the hard disk of my MacBook Pro and installed Windows 7 (64 bit). The Bootcamp driver package includes file system drivers (right term?) that enable Windows to access the Mac OS HFS+ partition. AFAIK it's a read-only access, but it works. Now, I have some disk images of stuff I usually install, so I grabbed a copy of Daemon Tools to mount them. When I mount an image saved on the HFS+ partition, about two out of three installers on these disks (usually InstallShield) crash with all sorts of weird errors. Most are just gibberish that lead to all sorts of non-solutions on Google, one was "This application is not the right type for your computer, check if you need 32 or 64 bit versions." When moving the image files to another Windows 7 computer on the network and mounting them from the network share, they work fine. My question now is, why do applications behave differently depending on whether the read-only image file, which should be abstracted away through the read-only virtual Daemon Tools drive, is located on a read-only HFS+ partition or on a Windows network share? And I'll just roll this into the question as well since I was wondering: Does the file system of a network share matter? Does the client system need to understand the file system of the share host or is that abstracted away in SMB?

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >