Daily Archives

Articles indexed Sunday August 24 2014

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

  • How to implement Fog Of War with an shader?

    - by Cambrano
    Okay, I'm creating a RTS game and want to implement an AgeOfEmpires-like Fog Of War(FOW). That means a tile(or pixel) can be: 0% transparent (unexplored) 50% transparent black (explored but not in viewrange) 100% transparent(explored and in viewrange) RTS means I'll have many explorers (NPCs, buildings, ...). Okay, so I have an 2d array of bytes byte[,] explored. The byte value correlates the transparency. The question is, how do I pass this array to my shader? Well I think it is not possible to pass an entire array. So: what technique shall I use to let my shader know if a pixel/tile is visible or not?

    Read the article

  • Different bounding volumes for culling and collision detection

    - by Serthy
    Should an object in a 3D-engine use different bounding volumes for collision-detection (broad-phase) and culling? Basically class renderBounds and class physBounds versus class boundingVolume? Each of this classes then could either contain the same type of volumes (AABB's, kDOP's, sphere's etc.) or a special fitting one for the particular object. (note: without considering of using an external physics engine)

    Read the article

  • What class to use in order to have a number move around the screen?

    - by AllenZ41
    What i am trying to accomplish is have a randomly created number move around the screen but it is touchable. I am planning to have lots of numbers on the screen, so my question is what class is appropriate to use, so I could set a number randomly at run time and display it while it moves around the screen? I was planning the use a TextView, since I want to use a custom font of mine but I think creating a bunch at a time could cause a memory problem and to my understanding they cant move around the screen at runtime.

    Read the article

  • Unity-Animation parameters are not being set

    - by user1814893
    I have the following animation controller: with two parameters of walkingSpeed and Jump. I have the following code which should change the values: animator.SetFloat("walkingSpeed",0.9f); animator.SetBool("Jump",true); and animator is the correctly referenced animator object. However the values that the parameters are set to do not appear to change in the animator window, nor do they appear to impact what is happening on the screen. However they do seem to impact the values obtained when doing the following: animator.GetFloat("walkingSpeed"); The animator consists of the shown blend tree, which works correctly and is always active, however due to the values not being changed it does not blends, and always acts as if the value with which it blends (walkingSpeed is 0). What is going on?

    Read the article

  • Mobile: Physics and movement actions

    - by meganegora
    I've been using spritekit for a while for a few small games. One thing I've noticed is that spritekit is the first game framework I've used that allows me to apply move actions to physics bodies. (without anything screwing up at least.) Are there any cross platform game frameworks I can use that allow move actions on physics bodies? Not impulses. I've used cocos2d in the past and when I tried ccmoveby on physics bodies the simulation would get totally confused. I rather not use cocos2d anyway. I'm asking because I want to make cross platform games and spritekit is iOS only.

    Read the article

  • How can I read from multiple textures in an OpenGL ES 2 shader?

    - by Peyman Tahghighi
    How can I enable more than one texture in OpenGL ES 2 so that I can sample from all of them in my shader? For example, I'm trying to read from two different textures in my shader for the player's car. This is how I'm currently dealing with the texture for my car: glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, this->texture2DObj); glUniform1i(1, 0); glBindBuffer(GL_ARRAY_BUFFER, this->vertexBuffer); glEnableVertexAttribArray(0); int offset = 0; glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, this->vertexBufferSize,(const void *)offset); offset += 3 * sizeof(GLfloat); glEnableVertexAttribArray(1); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, this->vertexBufferSize, (const void*)offset); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, this->indexBuffer); glDrawElements(GL_TRIANGLES, this->indexBufferSize, GL_UNSIGNED_SHORT, 0); glDisableVertexAttribArray(0); glDisableVertexAttribArray(1);

    Read the article

  • How do I add a Rigid body and a box collider component to a Texture2D?

    - by gamenewdev
    I am making a snake game. I'm basing it on a basic tutorial game, which does no collision detection, wall checking or different levels. All snake head, piece, food, even the background is made of Texture2D. I want the head of the snake to detects 2D collisions with them, but Rect.contains isn't working. I'd prefer to detect collisions by onTriggerEnter() for which I need to add BoxCollider to my snakeHead.

    Read the article

  • Linux - Bash Redirect a String to a file

    - by user3502786
    I wrote a simple script that is reading the file content and incrementing a a number inside this file, then i'm holding the change using awk, when i'm trying ro redirect the new String using '' the whole string is redirected in one line and not like the original was which is 4 lines. #!/bin/bash -x # This script is for Incrementing build numbers path=/home/RND/abrodov file=tst.txt tst=`cat $path/$file` printf "this is the content of the file before incrementing: \n $tst" newexpr=`awk '/^Build Number/{$4=$4+1;}1' /home/RND/abrodov/tst.txt` printf "\n the new content \n $newexpr" echo $newexpr > $path/$file This is the original file before running the script: Major Release Number = 4 Minor Release Number = 1 Service Pack Release Number = 2 Build Number = 22 This is the content after i used the script: Major Release Number = 4 Minor Release Number = 1 Service Pack Release Number = 2 Build Number = 23 I'm trying to figure out how can i redirect the text in the original format which is 4 lines.

    Read the article

  • Ajax, php, mysql not working mysql limit

    - by Hofmeister Ákos
    I have 3 files. list.php $articles = $mysqli->query("SELECT mainPictureBig, title, writer, writeDate, link FROM articles WHERE category=$this->category ORDER BY writeDate DESC LIMIT 0,10"); while($article = mysqli_fetch_row($articles)) { echo "<a href=\"".$this->url."/".$article[3]."/".$article[4]."\"><div id=\"listElement\"> <div id=\"listElementWallpaper\" style=\"background-image: url('category/img.jpg');\"></div> <div id=\"listElementContent\"><div id=\"listElementTitle\">".$article[1]."</div>".$this->giveWriter($article[2]).", ".$this->giveDate($article[3])."</div> </div></a>"; } $maximumElements=ceil($numberOfContent / 10) * 10; It's working, so there is no problem, it lists the first 10 elements from the sql table, and i got the $numberOfCOntent part also. Than i have a button: echo "<div id=\"listMore\"><div id=\"buttonOne\" onclick=\"listMore($this->category,$maximumElements)\">Load more</div></div>"; There is also no problem, i load the .js file, and it looks like: var from = 10; function listMore(categoryId, maximum) { $( "#listMore" ).slideUp( 200, function() { $( "#listMore" ).html("<center>Loading..</center>"); $( "#listMore" ).slideDown( 500, function() { $.post( "http://localhost/ajax.php", {type: "listMore", id: categoryId, sqlFrom: from} ) .done(function( elements ) { $("#listBody").append( elements ); if(maximum > from+10) { from = from+10; $( "#listMore" ).slideUp(200, function() { $( "#listMore" ).html("<div id=\"buttonOne\" onclick=\"listMore("+categoryId+","+maximum+")\">Load more</div>"); $( "#listMore" ).slideDown(200); }); } else $( "#listMore" ).slideUp(200); }); }); }); } And it's also working, and the problem is in the PHP file. As you can see, i'm sending an integer the "from" variable, the PHP file: $articles = $mysqli->query("SELECT mainPictureBig, title, writer, writeDate, link FROM articles WHERE category=$id ORDER BY writeDate DESC LIMIT $from,10"); It's also working, but not loading the next 10, only the next 9. So it skips the very next row and loads the rows only after the very first, so only 9. I tried to write here only the important part of the code, so i skipped some echo part etc. Any idea?

    Read the article

  • HTML chrome:// page with select box, onChange failing

    - by Noitidart
    I have a html page. It is chrome://. I have a select box. Giving it the oncommand attribute won't work. So I have to use onchange however you have the typical problem with onchange where it doesnt work if user uses the keyboard arrows, or letters of items to change things. Is there anyway to attach onCommand to my select box? I want to avoid to use onkeyup as then i have to to validation to see if it really changed (which would require me saving previous values).

    Read the article

  • Toggle a CSS selector using JQuery

    - by BEECHBOY707
    I am trying to toggle the display of a CSS selector (ie.to show/hide it) using JQuery. I successfully toggled the display of a div, but want to do this now with the CSS selector :after. The CSS selector is being used to create the arrow on the box. My attempt can be seen here: http://jsfiddle.net/beechboy707/7um9knxt/1/ Here is an extract from it showing the Jquery which is supposed to relate to the CSS selector: $("#supportus-button-1").click(function () { $(".supportus-button:after").toggle(); }); Many thanks for your help, Max

    Read the article

  • iOS app rejected by itunes team for copyright when embedding video from youtube

    - by Thiru Subramaniam
    I have created a simple app for my client with his selection of youtube videos embedded via iframe player and html5. The app got approved in android store whereas itunes rejected it claiming below, "Apps may not use protected third party material such as trademarks, copyrights, patents or violate 3rd party terms of use. Authorization to use such material must be provided upon request" Below is the link for the app in android. https://play.google.com/store/apps/details?id=com.jayam.shortfilms While I share videos using the html code obtained from youtube share button, still apple is claiming that I should provide evidence of copyright from each video owner. Any experiences of this kind will be very helpful for me.

    Read the article

  • Pass List of models to controller ASP.NET MVC 5

    - by user3697231
    I have a view where user can enter some data. But problem is this: Let's say you have 3 text box on view. Every time user can fill multiple times this 3 text boxes. To clarify, let's say user fills this 3 text boxes and press button which adds on form again these 3 text boxes. Now when user clicks submit this form is sent to controller, but how do I sent List of models as parameter. My architecture for this problem is something like this: MyModel public int ID { get;set; } public string Something { get; set; } /*This three textboxes can user set multiple times*/ /*Perhaps i Can create new model with these properties and then /*put List of that model as property here, but how to fill that list inside view ??*/ public string TextBoxOneValue { get; set; } public string TextBoxTwoValue { get; set; } public string TextBoxThreeValue { get; set; } Now, i was thinking that i Create PartialView with this 3 text boxes, and then when user clicks button on view another PartialView is loaded. And now, let's say I have Two partial views loaded, and user clicks submit, how that I pass list with values of these 3 text boxes to controller ??

    Read the article

  • Registration with profile picture using services in Drupal

    - by Fran Ruano
    I've been trying to upload a user profile picture during the user registration using Service 3 and so far I haven't had any luck. I tested passing a hard coded fid in the field "picture" and also tried to pass the fields "filemime", "filename", etc. and it didn't work neither. Any idea about what fields I need to populate? I guess it must be related to this post Using Drupal Services and DIOS SDK for setting user picture in iOS app but it doesn't have and answer neither.

    Read the article

  • How to find minimum weight with maximum cost in 0-1 Knapsack algorithm?

    - by Nitin9791
    I am trying to solve a spoj problem Party Schedule the problem statement is- You just received another bill which you cannot pay because you lack the money. Unfortunately, this is not the first time to happen, and now you decide to investigate the cause of your constant monetary shortness. The reason is quite obvious: the lion's share of your money routinely disappears at the entrance of party localities. You make up your mind to solve the problem where it arises, namely at the parties themselves. You introduce a limit for your party budget and try to have the most possible fun with regard to this limit. You inquire beforehand about the entrance fee to each party and estimate how much fun you might have there. The list is readily compiled, but how do you actually pick the parties that give you the most fun and do not exceed your budget? Write a program which finds this optimal set of parties that offer the most fun. Keep in mind that your budget need not necessarily be reached exactly. Achieve the highest possible fun level, and do not spend more money than is absolutely necessary. Input The first line of the input specifies your party budget and the number n of parties. The following n lines contain two numbers each. The first number indicates the entrance fee of each party. Parties cost between 5 and 25 francs. The second number indicates the amount of fun of each party, given as an integer number ranging from 0 to 10. The budget will not exceed 500 and there will be at most 100 parties. All numbers are separated by a single space. There are many test cases. Input ends with 0 0. Output For each test case your program must output the sum of the entrance fees and the sum of all fun values of an optimal solution. Both numbers must be separated by a single space. Example Sample input: 50 10 12 3 15 8 16 9 16 6 10 2 21 9 18 4 12 4 17 8 18 9 50 10 13 8 19 10 16 8 12 9 10 2 12 8 13 5 15 5 11 7 16 2 0 0 Sample output: 49 26 48 32 now I know that it is an advance version of 0/1 knapsack problem where along with maximum cost we also have to find minimum weight that is less than a a given weight and have maximum cost. so I have used dp to solve this problem but still get a wrong awnser on submission while it is perfectly fine with given test cases. My code is typedef vector<int> vi; #define pb push_back #define FOR(i,n) for(int i=0;i<n;i++) int main() { //freopen("input.txt","r",stdin); while(1) { int W,n; cin>>W>>n; if(W==0 && n==0) break; int K[n+1][W+1]; vi val,wt; FOR(i,n) { int x,y; cin>>x>>y; wt.pb(x); val.pb(y); } FOR(i,n+1) { FOR(w,W+1) { if(i==0 || w==0) { K[i][w]=0; } else if (wt[i-1] <= w) { if(val[i-1] + K[i-1][w-wt[i-1]]>=K[i-1][w]) { K[i][w]=val[i-1] + K[i-1][w-wt[i-1]]; } else { K[i][w]=K[i-1][w]; } } else { K[i][w] = K[i-1][w]; } } } int a1=K[n][W],a2; for(int j=0;j<W;j++) { if(K[n][j]==a1) { a2=j; break; } } cout<<a2<<" "<<a1<<"\n"; } return 0; } Could anyone suggest what am I missing??

    Read the article

  • Single page app with high number of images working extremely slow on iOS8 safari/Webview

    - by NikhilWanpal
    We are working on a WebView (not WKWebView, yet) app, are are observing that the app runs extremely slow on iOS 8. The same app runs smooth on lower versions of OS like iOS7 and iOS6. So we tried it in safari on iOS8 and the performance is similar to iOS6 and 7. The app is filled with images and many are high resolution. While trying to trace the issue (trial and error!) we reduced the sizes and resolutions of the images and the performance improved, but it is still not at par with versions 6 and 7. We are unable to find any such issues reported elsewhere and are stuck. It would be great if we could get some pointers on this one.

    Read the article

  • QConnect find no such slot on QCombobox by Qt Creater

    - by user2534154
    I create a window inherit from QWidget I set grid layout to that Window I make a function called handleHeroChange(int index) in public slot inside that window I add a Qcombobox to call that function handleHeroChange(int index). Qtcreator keep telling: QObject::connect: No such slot QWidget::handleHeroChange(int) in ../Testing/Window.cpp:92 Why did i do wrong? THE CODE: Window::Window(QWidget *parent) : QWidget(parent) { QGridLayout *grid = new QGridLayout(this); QComboBox *comboHeroClass = new QComboBox(); comboHeroClass->addItem("Witcher"); comboHeroClass->addItem("Maurander"); comboHeroClass->setCurrentIndex(1); grid->addWidget(comboHeroClass, 2,3,1,1); QComboBox::connect(comboHeroClass, SIGNAL(currentIndexChanged(int)),this, SLOT(handleHeroChange(int))); } void Window::handleHeroChange(int index){ QPixmap myImage; if(index == 0){ }else if(index == 1){ } }

    Read the article

  • How to get value of h:inputText when binded in JSF

    - by Tr?n Minh Phuong
    How can i get 2 h:inputTextValue from this? <h:dataTable cellspacing="0" value="#{managerManagedBean.lstMatch}" var="m" binding="#{managerManagedBean.datatableMatch}"> <!-- cellspacing='0' is important, must stay --> <h:column> <f:facet name="header">Team One</f:facet> <h:outputText value="#{m.teamOneName}"></h:outputText> </h:column> <h:column> <f:facet name="header">Match Score</f:facet> <h:inputText value="#{m.teamOneResult}" style="width: 20px; text-align: center" binding="#{input}"></h:inputText> - <h:inputText value="#{m.teamTwoResult}" style="width: 20px; text-align: center"></h:inputText> </h:column> <h:column> <f:facet name="header">Half Time</f:facet> <h:outputText value="#{m.haveHalfTime}"></h:outputText> </h:column> <h:column> <f:facet name="header">Team Two</f:facet> <h:outputText value="#{m.teamTwoName}"></h:outputText> </h:column> <h:column> <f:facet name="header">Match Date</f:facet> <h:outputText value="#{m.matchDate}"></h:outputText> </h:column> <h:column> <f:facet name="header">Control</f:facet> <h:commandButton action="#{managerManagedBean.update(m, input.value)}" value="Update Match"> </h:commandButton> </h:column> </h:dataTable>

    Read the article

  • Rails 3 : create two dimensional hash and add values from a loop

    - by John
    I have two models : class Project < ActiveRecord::Base has_many :ticket attr_accessible .... end class Ticket < ActiveRecord::Base belongs_to :project attr_accessible done_date, description, .... end In my ProjectsController I would like to create a two dimensional hash to get in one variable for one project all tickets that are done (with done_date as key and description as value). For example i would like a hash like this : What i'm looking for : @tickets_of_project = ["done_date_1" => ["a", "b", "c"], "done_date_2" => ["d", "e"]] And what i'm currently trying (in ProjectsController) ... def show # Get current project @project = Project.find(params[:id]) # Get all dones tickets for a project, order by done_date @tickets = Ticket.where(:project_id => params[:id]).where("done_date IS NOT NULL").order(:done_date) # Create a new hash @tickets_of_project = Hash.new {} # Make a loop on all tickets, and want to complete my hash @tickets.each do |ticket| # TO DO #HOW TO PUT ticket.value IN "tickets_of_project" WITH KEY = ticket.done_date ??** end end I don't know if i'm in a right way or not (maybe use .map instead of make a where query), but how can I complete and put values in hash by checking index if already exist or not ? Thanx :)

    Read the article

  • How to use JSON response in the form of JSTL?

    - by HariKrishna
    I am getting JSON response,now i need to construct a table using this response.The table may be contain more than one record and i know one way of doing this is using Jstl tags but not JSON response.Here is my jsp code <div id="divHideAllergies" class="clone"> <div class="copy"> <div class="col-md-12"> <div class="portlet box carrot "> <div class="portlet-title"> <div class="caption"> <i class="fa fa-medkit"></i> Allergies </div> </div> <div class="portlet-body form"> <div class="form-body"> <div class="form-group"> <label class="control-label col-md-3">Allergy Type:</label> <div class="col-md-9"> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-medkit"></i></span> <select class="form-control" id="allergy_type"> <option selected value="">--Select One--</option> <option value="Drug">Drug</option> <option value="Environmental">Environmental</option <option value="Food">Food</option> </select> </div> </div> </div> <div class="form-group"> <label class="control-label col-md-3">Allergic to:</label> <div class="col-md-9"> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-medkit"></i></span> <input type="text" class="form-control" name="first name" id="allergy_to"/> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div>

    Read the article

  • select dropdown option by value using jquery

    - by user1765862
    I have select following html structure <select id="mainMenu" data-mini="true" name="select-choice-min"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> </select> on page load I want initially set option with value 5 so I tried (but nothing changed) $(document).ready(function () { $('#mainMenu option').eq(5).prop('selected', true); }) I'm using jquery 1.8.3 and jqueyr mobile since this is mobile website <script src="/Scripts/jquery-1.8.3.js"></script> <script src="/Scripts/jquery.mobile-1.4.2.js"></script> UPDATE: I just realize that every code from posted answers works (as well as mine), #mainMenu option value is set to desired value (5) but it's text doesnt change (in any of this scenarios). Is this normal and is there workarround for this. I tried $("mainMenu").text("5");

    Read the article

  • Create a combobox by using HTML item list

    - by erkan_ayan
    How can I show only first li and hide the others? I am trying to do a combobox via jQuery: My jQuery script: var drp = $('.drpdiv'); $(drp).each(function(index,value){ $(this).find('li:first').text() $(this).find('li').hide(); alert($(this).find('li:first').text()); }); My html code: <div class="drpdiv"> <ul class="drp"> <li>select option...</li> <li>one</li> <li>two</li> <li>three</li> </ul> </div>

    Read the article

  • How to run an .exe application in another computer?

    - by ADAM
    I am working on a C# application in Visual Studio 2013. When I run the .exe file from my computer, the application runs very well and all the features work. When I tried to run the .exe on another computer, the database side doesn't work well and the connection with the database couldn't be opened. The SqlConnection is constructed as follows: SqlConnection cn = new SqlConnection("Data Source=ADAM-PC;Initial Catalog=integrationdatabase;Integrated Security=True" I don't know how to change the data source to make the connection with the database established in another computer. How can I solve this problem?

    Read the article

  • EMV credit/debit card chip application

    - by rohitamitpathak
    I am working in smart card industry and familiar with ISO 7816 and Java Card. Till now I worked for ID card, Health card and SIM application using GSM standard. Now I have a chance to work in EMV. Here I have some confusion like: Is a EMV credit/debit card will be a java card containing applet inside it? what standard I need to go through to develop emv debit/credit card application? Is there any good tutorial which helps to understand about EMV debit/credit Card application development? Is there any good simulator to develop and test emv card application?

    Read the article

  • CefSharp.BrowserSubprocess.exe has stopped working

    - by Amogh
    I have CefSharp-master project with which is Built on Chromium- 31.0.1650.57. All is working fine and perfect, but when I click on link to load/view PDF file on an website and popup get loaded and after some time I got dialog box saying "CefSharp.BrowserSubprocess.exe has stopped working." and oped popup window become black. Below is what I found in windows event viewer.. Application: CefSharp.BrowserSubprocess.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.AccessViolationException Stack: at <Module>.CefExecuteProcess(CefMainArgs*, CefRefPtr<CefApp>*) at CefSharp.CefAppWrapper.Run(System.String[]) at CefSharp.BrowserSubprocess.Program.Main(System.String[]) What is problem? I searched a lot but didn't find any think.

    Read the article

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