• What Do You Need Help With? V6
    7,544 replies, posted
Well the semi-circle your describing (-90 -> 90) contains 180 degrees (or PI radians - use radians) The used hours as a percentage of max hours is just used/max ... So multiply that by PI and you get your angle.
[QUOTE=Lemmingz95;43944620]Well the semi-circle your describing (-90 -> 90) contains 180 degrees (or PI radians - use radians) The used hours as a percentage of max hours is just used/max ... So multiply that by PI and you get your angle.[/QUOTE] Ok that helps me a little i understand what do you mean i and tried but i do it wrong. 120/150 = 0,8 0,8*pi = 2,51 Or does Multiply mean 0,8*pi² ?
That result is correct, you just need to subtract pi/2 (quarter circle) to get it to the -pi/2 - pi/2 range you need. Unless, of course, you can't output radians, in which case you need to use 180 in place of pi everywhere. (Pi is only a half circle in radians, which is really annoying when working with it [URL="http://www.youtube.com/watch?v=FtxmFlMLYRI"]so there's an alternative[/URL].)
[QUOTE=Tamschi;43944899]That result is correct, you just need to subtract pi/2 (quarter circle) to get it to the -pi/2 - pi/2 range you need. Unless, of course, you can't output radians, in which case you need to use 180 in place of pi everywhere. (Pi is only a half circle in radians, which is really annoying when working with it [URL="http://www.youtube.com/watch?v=FtxmFlMLYRI"]so there's an alternative[/URL].)[/QUOTE] Okey, i found out my own solution and it it right to. here my example MaxHour=150 UsedHour=120 Prozent=120/150*100 = 80% angle=(180* (80/100))-90 = 54 so angle is 54° hope i typed it right greetings
[QUOTE=aehm ?;43945090]Okey, i found out my own solution and it it right to. here my example MaxHour=150 UsedHour=120 Prozent=120/150*100 = 80% angle=(180* (80/100))-90 = 54 so angle is 54° hope i typed it right greetings[/QUOTE] I hope you're using floating point numbers... Replace 100 with 100% (=1) everywhere, what you're doing now is a really roundabout way of getting the right value.
I'm pretty lost on how to construct a JSONObject in the way I want (Android/Java). My google skills don't seem to be enough. This is essentially how I want it to look like, with the possibility of multiple answers for the same form. [CODE]JSONObject = { "username": "John", "Organization": "dummy", "completed form number 1": [ { "answer": [ { "name": "One", "score": 90 }, { "name": "Two", "score": 96 } ] }, { "answer": [ { "name": "One", "score": 79 }, { "name": "Two", "score": 84 } ] }, { "answer": [ { "name": "One", "score": 97 }, { "name": "Two", "score": 93 } ] } ] "completed form number 2": [ { "answer": [ { "name": "One", "score": 90 }, { "name": "Two", "score": 96 } ] }, { "answer": [ { "name": "One", "score": 90 }, { "name": "Two", "score": 96 } ] } ] }[/CODE] I have no idea on how to make sure the structure is correct when coding from Java/Android. I'm currently using a simple [CODE]List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("tag", tag)); params.add(new BasicNameValuePair("username", username)); JSONObject json = jsonParser.getJSONFromUrl(URL, params);[/CODE] for my other purposes, but I don't see how that would work with what I want to do without sending answers separate which is really redundant. Is it possible to add a HashMap<String,String> to the jsonobject, or is there a specific way I should use to construct my JSONObject with several objects?
Can anyone tell me why Java is such a fucktard? scanner.nextLine() is meant to throw a NoSuchElementException if nothing is in the buffer, yet when connected to a sockets InputStream it just hangs and waits for more data to enter the buffer... WHUT?
[QUOTE=reevezy67;43884027]Another OpenGL question. Does anyone know any open source 3D games using modern OpenGL? I could use some examples.[/QUOTE] This is actually a really good question. I'd like some examples too.
[QUOTE=Richy19;43951916]Can anyone tell me why Java is such a fucktard? scanner.nextLine() is meant to throw a NoSuchElementException if nothing is in the buffer, yet when connected to a sockets InputStream it just hangs and waits for more data to enter the buffer... WHUT?[/QUOTE] The default streams in every language do this, they always block if the source wasn't closed. I think in C# you can check whether data is available through a property, Java should have something similar. Alternative: Start a new thread for the read and kill it after a second :v:
How do you guys manage to get two libraries working together nicely when they use different Vector classes? I have my main program (lets just call it main), then I'm using a library that references and uses the Vector3 from the SharpDX library. Also I have another library that uses its own Vector3 class. I dont want to include the whole SharpDX library just because of its vector class and I can't change and recompile it. I just want one single Vector3 struct/class that I can use troughout the whole VisualStudio-Solution. Is there a way to do this? I already tried to unsafe-cast the different vectors and it works. But this still doesn't get rid of the SharpDX library...
[CODE]package catapult01; import java.util.Arrays; import java.util.Scanner; public class Catapult01 { static Scanner keyboard = new Scanner(System.in); public static void main(String[] args) { String[][] plane = new String[10][10]; int x = (int) (1 * Math.random() * 10); int y = (int) (1 * Math.random() * 10); while (1 >= 0) { findTrajectory(plane, x, y); printGrid(plane); direction(plane, x, y); } } public static void findTrajectory(String[][] plane, int x, int y) { System.out.println("X " + x); System.out.println("Y " + y); for (int i = 0; i < plane.length; i++) { plane[x][y] = "*"; //start point for (int j = 0; j < plane[i].length; j++) { if (plane[i][j] == null) { plane[i][j] = " "; } } } } public static void printGrid(String[][] plane) { for (int i = 0; i < plane.length; i++) { for (int j = 0; j < plane[i].length; j++) { System.out.print(plane[i][j] + " "); } System.out.println(""); } } public static String direction(String[][] plane, int x, int y) { char dir; System.out.println("W = up \n" + "S = down \n" + "A = left \n" + "D = right"); dir = keyboard.next().charAt(0); if (dir == 'W' || dir == 'w') { for (int i = 0; i < plane.length; i++) { plane[x - 1][y] = "*"; plane[x + 1][y] = null; for (int j = 0; j < plane[i].length; j++) { System.out.print(plane[i][j] + " "); return plane[i][j]; } System.out.println(""); } } if (dir == 'A' || dir == 'a') { for (int i = 0; i < plane.length; i++) { plane[x][y - 1] = "*"; plane[x][y + 1] = null; for (int j = 0; j < plane[i].length; j++) { System.out.print(plane[i][j] + " "); return plane[i][j]; } System.out.println(""); } } if (dir == 'S' || dir == 's') { for (int i = 0; i < plane.length; i++) { plane[x + 1][y] = "*"; plane[x -1][y] = null; for (int j = 0; j < plane[i].length; j++) { System.out.print(plane[i][j] + " "); return plane[i][j]; } System.out.println(""); } } if (dir == 'D' || dir == 'd') { for (int i = 0; i < plane.length; i++) { plane[x][y + 1] = "*"; plane[x][y - 1] = null; for (int j = 0; j < plane[i].length; j++) { System.out.print(plane[i][j] + " "); return plane[i][j]; } System.out.println(""); } } return null; } } [/CODE] [IMG]http://i.imgur.com/30IsqOh.gif[/IMG] I accidentally made tetris instead of snake? How do I move the star across the screen? Now I'm just depressing myself.
[QUOTE=Felheart;43957790][...] Is there a way to do this? [...][/QUOTE] No. (You might be able to do a find and replace with Mono.Cecil on the binaries, but that's slightly hacky.)
[QUOTE=Tamschi;43960116]No. (You might be able to do a find and replace with Mono.Cecil on the binaries, but that's slightly hacky.)[/QUOTE] Doesn't matter if its hacky, it's actually a really good idea! I'm gonna try that.
Hi there, I'm just wondering if anyone can tell me how to implement a void function held in another file, for example, "foo.cpp" - obviously being defined through "foo.h" - using Windows API? By this I mean the function must output to the interface and not to the Command Prompt. I presume you must implement it through WndProc function? In a WM_CREATE case?
I'm trying to create a radial menu program for windows in C#.. I think I can manage everything except I can't figure out how to block the default right click menu from showing up... I don't really want to straight block the raw mouse input events because that seems... bad... but I would like to block the right click context menu from showing up globally, and handle it manually. Any ideas on how I would go about this?
[QUOTE=BL00DB4TH;43976156]I'm trying to create a radial menu program for windows in C#.. I think I can manage everything except I can't figure out how to block the default right click menu from showing up... I don't really want to straight block the raw mouse input events because that seems... bad... but I would like to block the right click context menu from showing up globally, and handle it manually. Any ideas on how I would go about this?[/QUOTE] Use the raw mouse input events, I don't think there's a central context menu hook.
I'm not sure how to go about this, it seems like something easy but I just can't get the answer. I've made a Window class in Lua for Love2d that handles the contents and drawing of windows/ ui. I've given the window class a draw function, but how exactly would I cause that draw function to be called in love.draw()? The "definition" of the class is as follows ( windowclass.lua) [code]Window = {}Window.__index = Window -- everyone loves greek letters >> &#8710;&#8706;&#920;&#955;&#969;&#947;&#915; -- GLOBAL WINDOW OPTIONS -- CHANGE THIS MOTHERFUCKING SHIT IF YOU WANT TO windowlist = {} window_min&#8710;x = 96 window_min&#8710;y = 96 window_max&#8710;y = love.graphics.getWidth() window_max&#8710;x = love.graphics.getHeight() cs_gs = {16,22} cs_rgb = {} cs_rgb.bg = {37,38,43,255} cs_rgb.elem = {28,30,33,255} cs_rgb.edgehigh = 6 cs_rgb.desctxt = {111,113,117,255} window_isGreyscale = true -- state wether window is a teenager or not window_isEdgey = false function Window.create(name,desc,x,y,&#8710;x,&#8710;y,static,resize,z,hidden) local wind = {} setmetatable(wind,Window) wind.name = name wind.desc = desc wind.x = x wind.y = y wind.&#8710;x = math.clamp(window_min&#8710;x, &#8710;x, window_max&#8710;x) wind.&#8710;y = math.clamp(window_min&#8710;y, &#8710;y, window_max&#8710;y) wind.isStatic = static wind.isResize = resize wind.z = z wind.isHidden = hidden table.insert(windowlist,self) return wind end function Window:setX(newx) self.x = newx end function Window:setY(newy) self.y = newy end function Window:setWidth(new&#8710;x) self.&#8710;x = new&#8710;x end function Window:setHeight(new&#8710;y) self.&#8710;y = new&#8710;y end function Window:setZ(newZ) self.z = newZ end function Window:getZ() return self.z end function Window:getWidth() return self.&#8710;x end function Window:getHeight() return self.&#8710;y end function Window:getResizable() return self.resize end function Window:getStatic() return self.isStatic() end function Window:draw() if not self.isHidden then setColourBG() love.graphics.rectangle("fill",self.x,self.y,self.&#8710;x,self.&#8710;y) if window_isEdgey then setColourBGEdge() love.graphics.rectangle("line",self.x,self.y+32,self.&#8710;x,self.&#8710;y-32) end end end function setColourBG() love.graphics.setColor(cs_rgb.bg[1],cs_rgb.bg[2],cs_rgb.bg[3],cs_rgb.bg[4]) end function setColourBGEdge() love.graphics.setColor(cs_rgb.bg[1]+cs_rgb.edgehigh,cs_rgb.bg[2]+cs_rgb.edgehigh,cs_rgb.bg[3]+cs_rgb.edgehigh,cs_rgb.bg[4]) end function Window:think() end [/code] This is loaded ( and so is exmaths.lua, a file that adds lerp and clamp to the maths class) to the main lua file as a required file. So.. How exactly do I call this draw function for each window "entity" at love.draw()?
Would many people here find use in an OpenGL help thread? I am tempted to make one because i have a fair amount of opengl questions. For the time being i'll post here. Can someone explain why this doesn't draw anything? [code] void drawSkeleton() { if (bones.size() == 0) { cout << "ERROR - NO BONES!" << endl; return; } glEnable(GL_LIGHTING); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glDisable(GL_CULL_FACE); glDisable(GL_POLYGON_OFFSET_FILL); glBegin(GL_LINES); glColor3f(1.0, 0, 0); for (std::vector<Bone>::size_type i = 0; i != bones.size(); i++) { Joint jnta = *bones[i].jointA; Joint jntb = *bones[i].jointA; glVertex3f(jnta.vector[0], jnta.vector[1], jnta.vector[2]); glVertex3f(jntb.vector[0], jntb.vector[1], jntb.vector[2]); } glEnd(); }[/code] I've read that GL_LINES can be problematic, i don't know what else to do. None of the bones draw.
Just curiosity - why does C++ take much more time to compile than many more modern languages? My last project took approx. 1 hour to build... Just a Hello World takes 5 seconds instead of C#'s 1 second.
[QUOTE=Liota;43984054]Just curiosity - why does C++ take much more time to compile than many more modern languages? My last project took approx. 1 hour to build... Just a Hello World takes 5 seconds instead of C#'s 1 second.[/QUOTE] I guess it's due to the sheer complexity of the language and the fact that include directives are just text expansions. For example your simple Hello World will feed the compiler with a file of more than 80.000 lines of code (in Visual Studio).
I am playing with Android and GLES1. How could I render strings to the gl context? I don't know what keywords I need to search.
[QUOTE=Instant Mix;43982426]I'm not sure how to go about this, it seems like something easy but I just can't get the answer. I've made a Window class in Lua for Love2d that handles the contents and drawing of windows/ ui. I've given the window class a draw function, but how exactly would I cause that draw function to be called in love.draw()? The "definition" of the class is as follows ( windowclass.lua)[/QUOTE] [lua] function love.draw() for k,v in pairs(windowlist) do v:draw() end end [/lua] ?
[QUOTE=Liota;43984054]Just curiosity - why does C++ take much more time to compile than many more modern languages? My last project took approx. 1 hour to build... Just a Hello World takes 5 seconds instead of C#'s 1 second.[/QUOTE] I'm interested in how you made a project take an hour to build, even a Source mod only takes about 5 to 10 minutes (maximum) to build from scratch. After that it's a matter of seconds unless you make huge modifications or rebuilt.
I'm thinking of making a top-down game in OpenGL, and I was wondering what would be the best way to approach the problem of seeing things that the character can see but that are occluded from the top-down perspective. I was thinking of having a cubemap without a top and bottom cast out from the player, which will store the depth of all the pixels it sees. Then, I would render from the top-down perspective using a stencil buffer and compare the depth of the bits that are visible and store the most deep one. I would then only render the deepest visible depth. This all sounds computationally intensive, and I was wondering if this would even work and if there's a better way to do it.
I want to make a native android app that connects to a Web API (that returns JSON). Are there any frameworks/libraries made for this?
[QUOTE=BackwardSpy;43986203]I'm interested in how you made a project take an hour to build, even a Source mod only takes about 5 to 10 minutes (maximum) to build from scratch. After that it's a matter of seconds unless you make huge modifications or rebuilt.[/QUOTE] Was probably more then 1 build, x86-32 debug, x86-32 release, x86-64 debug, x86-64 release, etc. SDL2 does something like that, and tends to take a pretty long time, especially on older machines.
[QUOTE=PortalGod;43985841][lua] function love.draw() for k,v in pairs(windowlist) do v:draw() end end [/lua] ?[/QUOTE] Doesn't work which is fairly annoying. Tried printing windowlist[1] and it comes up with Nil. The code in the windowclass is identical, but here's what i've edited main.lua to look like [code] require("exmaths") require("windowclass") function love.load() love.graphics.setBackgroundColor(37,37,37) height = love.graphics.getHeight( ) width = love.graphics.getWidth( ) createSomeWindows() end function love.draw() --window1:draw() --window2:draw() --window3:draw() for k,v in pairs(windowlist) do v:draw() end end function createSomeWindows() window1 = Window.create("Quad Editor","A is for Apfel",8,8,200,400,true,false,4,false) window2 = Window.create("Texture Panel","fsa",216,32,256,100,true,false,4,false) window3 = Window.create("Chicken Fajitas","f",128,400,128,128,true,false,4,false) end [/code] if instead of the for loop I just use window1:draw() then it draws fine. Should I add maybe window1 to the windowtable somehow?
[QUOTE=Instant Mix;43989220]Doesn't work which is fairly annoying. Tried printing windowlist[1] and it comes up with Nil.[/QUOTE] [lua]table.insert(windowlist,self)[/lua] bottom of the Window.create function, change self to wind
[QUOTE=PortalGod;43989418][lua]table.insert(windowlist,self)[/lua] bottom of the Window.create function, change self to wind[/QUOTE] ah right! cheers. Trying to get my head round this class stuff, first time tackling it. Thanks man
So like I said before, I am looking for ideas for a basic data mining project to help me learn it. I was thinking of doing something on rotten tomatoes. Is this possible? Any ideas for a decent project I could do with Rotton Tomatos? Something like find out if the average rating of hollywood films is increasing or decreasing every year?
Sorry, you need to Log In to post a reply to this thread.