old thread: What are you working on, Sup Forums?
/dpt/ - Daily Programming Thread
Other urls found in this thread:
github.com
deskthority.net
en.cppreference.com
pastebin.com
pastebin.com
bitbucket.org
open.gl
twitter.com
Dear /dpt/
I don't know jack shit about code, so please be kind to me and use as simple language as possible
I'm getting a syntax error with this bit of code when I try to compile
#include "keymap_common.h"
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty */
KEYMAP(ESC, 1, 2, 3, \
1, 2, 3, 4, \
1, 2, 3, 4, \
1, 2, 3, \
1, 2, 3, 4, \
1, 2 )
};
And here's the error message in question
keymap_poker.c:11:2: error: expected '}' before ';' token
;
^
What do I have to change in my code to make it compile properly? Thanks a lot in advance
It's the TMK keyboard firmware in case anyone's wondering, pic related
>lowercase old thread
is that you, trap fag?
try:
add a ; after ) before };
catch:
if it doesnt work
what's the KEYMAP macro definition?
try removing the {}? probably the KEYMAP macro does it for itself
Both values (cotton-eye-joe and penisCocks) are actually in the list after checking that out, but only penisCocks is printed.
Pls tell me what's wrong with my game of life:
github.com
It's written in C++.
>uses 1.5GB ram
WHAT
You forgot to use comonads
Should have used an Arduino and wrote your own firmware from scratch, famalam :^)
Here's what the code's supposed to look like
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty */
KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, GRV, BSLS, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
LCTL, A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \
LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, \
LALT, FN1, SPC, PAUS,RALT),
};
deskthority.net
Did not work unfortunately, just gave me a second error message
keymap_poker.c:10:18: error: expected '}' before ';' token
1, 2 );
^
keymap_poker.c:11:3: error: expected '}' before ';' token
};
^
Also an error
KEYMAP(ESC, 1, 2, 3, \
^
keymap_poker.c:5:5: warning: (near initialization for 'keymaps[0][0]') [-Wmissing-braces]
keymap_poker.c:10:18: error: expected '}' before ';' token
1, 2 );
^
200 500x500 sized images are expensive. Any idea on how to reduce the size? Didn't find anything on magick++ docs.
A question to C/C++ fags:
int a = 1;
int b = 2;
int c = a---b;
Does c evaluate to (a--) - b or to a - (--b)?
You've got to be doing something silly in your code.
Pastebin the entire method that fires when you change the dropdown selection.
Why the fuck would you need to store them all?
>200
What the fuck?
You only need 1
To make a gif.
Why are you storing them all in memory?
>What are you working on
a table
Have you never thought to free the last frame after you're done with it?
Compression of some sort.
IF memory is really that restrictive you're going to have to bite the bullet and take the reduction in speed by decompression on the fly.
Am I really a garbage-tier programmer if I use GLFW? I did some googling and everyone says it's retarded to interface with xlib directly, and there is NO FUCKING WAY I'm going anywhere near the shitshow that is Qt. Am I actually losing out on anything by using GLFW?
I'm just writing a simple OpenGL data visualization tool.
200 x 500 x 500 = 50000000 = 50,000,000
50 Mb
assuming you unfortunately needed 24 bytes per pixel, for some weird reason
50 Mb * 24 = 1200Mb = 150MB
so does it work when you copy paste the example code verbatim? my guess is this errors cos you are passing fewer arguments into the macro than it expects but then i also thought you get an error if you give a c macro the wrong number of arguments so what do i know
>Am I really a garbage-tier programmer if I use GLFW?
Not at all.
GLFW is probably the best choice for OpenGL applications.
So write to disk and retrieve them in batches.
There's nothing wrong with GLFW. If all you need is an OpenGL context you should use whatever gets you there in the easiest way. Writing platform specific code for it is just unnecessary masturbation shit.
>Am I really a garbage-tier programmer if I use GLFW?
Yes, use SDL.
>implying he doesn't have 8 objects containing duplicate data for each frame
Working on 2D game engine with c++ and lua, exported 40 function from c++ to lua, now it has nice little small api
For now "engine" reads config.lua for resolution, fps, vsync and that stuff, and main.lua for load, update, draw... Lua handles all logic, c++ just does math and puts stuff on screen
>Use a library that has a ton of features you have no use for to set up an OpenGL context
I use SDL myself but really dude?
well you lose out as soon as you want an actual ui or portability. if you just want to render stuff and maybe have mouse events then who cares.
Cool.
Nice job.
SDL is awesome for quick and dirty stuff
And GLFW is even quicker and dirtier for this purpose
>finally decide to set up Spacemacs
>MELPA is down
Fuck this gay earth
>spacemacs
meme editor
>SDL, king of bloat, awesome for quick and dirty stuff
Kek. I hope you engine your gayme engine kiddo. I'll be over here using Wayland.
Sounds noice. Puts me in awe. Post updates.
(pic related: just a little reward for rocking all the way)
Did you see the code? I don't think that's possible.
It's imagemagicks magick. I don't know why the fuck images are so big.
How do i make gif without loading images to memory? Using magick++
Ok thanks
>spacemacs
why do people keep falling for these "u're choice!!1!" meme projects? just use plain emacs
What you suggest using wayland specific code? Have a good time running that anywhere else...
>Wayland
>comparable to SDL
???
>he saves 2 hours out of a potentially 1000+ hour project by using SDL instead of writing more performant, more controllable, 100% customized per-platform code
You're the meme now, friend
Yes, the performance of my OpenGL context creation is of utmost importance.
If you want performance you use OpenGl not native code, what kind of autistic masochist are you?
And for 2D games even opengl is overkill
R8 my FB! It ran on the first try!
package main
import "fmt"
func main() {
for i := 1; i
user was doing haskell prime sieve earlier
here's a (slightly altered*) sieve from the haskell wiki
{-# OPTIONS_GHC -O2 -threaded #-}
{-# OPTIONS_GHC -with-rtsopts="-n10" #-}
import Data.Array.Unboxed
import System.Environment (getArgs)
primesToA :: Int -> [Int]
primesToA m = sieve 3 (array (3,m) [(i,odd i) | i UArray Int Bool -> [Int]
sieve p a
| p*p > m = 2 : [i | (i,True)
Well it's not that it doesn't flat-out work, it just doesn't print both items if I only have two pieces of data within the list. It's the only case where it happens: if I reduce the item list to 1, it prints out the one fine. If I up it to three or more, it prints out all three no issue.
This is the method without placeholders like aThousandDicks. [source] is just the filepath.
Software blitting is slow as shit. If your 2D game wants to run above 720p at 60fps you're going to need to use OpenGL or require an i7 processor as your minspec
compile it with GHC
ghc file.hs
run it with the number
file 2000000
You can get hardware accelerated rendering without using raw OpenGL. Using SDL, for example.
Yes maybe i went bit too far but SDL2 does in fact use hardware blitting, SDL1 used sw
>And for 2D games even opengl is overkill
S U M M E R
U
M
M
E
R
comming from book thread
what book you've read in the past would you recommend ?
SDL is just an abstraction layer on top of opengl
No one has used magick++ before? Is there a better alternative?
Thanks for your insight
refer to But my point still stands
opengl is not overkill for PROPER 2d games, SDL IS FUCKING SHIT, you could use a game engine but even with a game engine for a craptacular 2d gaym if you have the slightest clue what you're doing you should be writing shaders and such
parsing techniques: a practical guide
obviously only useful if you care about parsing
>if I reduce the item list to 1, it prints out the one fine. If I up it to three or more, it prints out all three no issue
Odd.
So after the while statement, if countyTransfer has exactly two, you get the issue, but only if it has exactly two elements.
Is that correct?
Honestly, I don't see anything that would cause that in any of the code you've posted, unless you're using some sort of pants-on-head GUI control library.
I'd need to build your project and play with it myself to try to duplicate the issue.
Try re-arranging where you set the ItemsSource:
pastebin.com
well if its a good read I'll look into it
thanks for the suggestions though
What's so shit about SDL user? Dota 2 uses SDL. I'm sure if it's good enough for Valve, it's good enough for me.
using SDL for 3d is basically the same as using raw opengl, the convenience shit is only basic 2d stuff, if you don't want your game to look like mspaint bullshit you'll be using opengl directly
>3D graphics:
>SDL can be used in combination with the OpenGL API or Direct3D API for 3D graphics
>Accelerated 2D render API:
>Supports easy rotation, scaling and alpha blending, all accelerated using modern 3D APIs
>Acceleration is supported using OpenGL and Direct3D, and there is a software fallback
>If your 2D game wants to run above 720p at 60fps you're going to need to use OpenGL or require an i7 processor as your minspec
No.
Task: write a program that outputs a cross to the terminal
#include
#include
void printX(int lines){
for(int i = -lines/2;i
I'm working on trying to define a variable inside an if statement in scheme
(if (> number1 number2) (define x number1)
(else define x number2))
assuming number1 and number2 are alredy defined this should work, right?
homework help ? writing a program in C; that shifts strings left or right to a desired amount by the user. i have not figured out how to contain the shifting so that if the user goes over 'z'(right shift too far) or under 'a'(left shift too far) it would reset ?
>is there a lib for this ? im new here
example:
"abcxyz"
shifted to right 8
"ijkfgh"
how i modulo i dont fucking understand ? pls atleast link me to something
Arent you the same guy who was couple of minutes ago advocating using native wayland code?
Nice argument. Have you done high res software rendering before?
This should be a legitimate replacement for fizzbuzz.
It actually forces you to think.
yes im the guy from last thread
V V here
no, that guy uses capitalization and punctuation
How do I learn haskell? I was reading learn you a great haskell but then i read someone shit on it so I started doing CIS 194 but it's fucking boring and I want to get on to making my own project, but I fear that I'm going to not abstract anything since I know basically enough to program anything (just stacking functions and the type system) but not enough to do the actual cool stuff.
Oooh okay, i was suprised by display of sanity.
So for 2D games do you think opengl is a must? Considering SDL2 does use it behind the scenes for hw acceleration.
dude if you spend an hour failing at this problem, you really should not pass this class
just google caesar code c implementation and there are tons of resources/solution just one google query away
its fucking embarrassing
>inb4 i took the bait
>haskell
>doing cool stuff
you got rused
who reverse engineering here?
smali code is ok i guess. want reliable ways to get the full java source for analysis and review.
any tools to reverse all codes that outputs are close to being replicated without errors or interpreted?
any past experiences to share?
it depends on what you're doing, but imo i think it's best if you learn how to replicate the SDL stuff yourself (using linear algebra in a shader for rotation and scaling) and then you can build upon those skills. if you're going for a retro look then just using SDL stuff and not having fancy shaders could be ok.
LYAH is fine for a beginner, but it's full of autism
x == y or x == n-y
barring linear transformations, and maybe adding or removing 1 from n
If you don't understand the modulo thing just make some if statements checking if you're out of bounds
was it you asking "how to convert chars to ints?" too?
Do you have some books or sites to recommend for learning OpenGl properly?
I had couple of pleasant experiences with jdGUI and some other online decompilers if you already have the bytecode
I wouldnt count that reverse engineering, if that answer covers your question
Why don't you?
Are you underage or something?
I'm not spoonfeeding you the actual solution so you better sort yourself out.
for (int i = 0; i < 100; i++)
Write(i % 11 + ", ");
Best source is the Arc Synthesis tutorials. bitbucket.org
Teaches you "MODERN" OpenGL, not the outdated fixed-function stuff.
from string import letters
list_of_letters = list(letters[0:26])
def rotate(your_string, num_shifts):
n = []
for i in range(len(your_string)):
pos = list_of_letters.index(your_string[i])
new_pos = (pos + num_shifts) % 26
n.append(list_of_letters[new_pos])
return ''.join(n)
print rotate("abcxyz",8)
probably this: and open.gl
and read the opengl wiki, the opengl reference pages and the opengl spec, not all at once but for the specific topic (VBO, FBO or whatever) you're working on at the moment
> So after the while statement, if countyTransfer has exactly two, you get the issue, but only if it has exactly two elements. Is that correct?
Yes.
>pants-on-head GUI control library
I dunno if WPF is pants-on-head but there's a bit more documentation for WinForms over it.
>Try re-arranging where you set the ItemsSource:
Will report back.
this compiles well with gcc thx
Thank you very much. I tried to learn it couple of time but it would always be some old tutorial....
Fast report back; shifting the ItemsSource where I set the list.ItemsSource equal to the list holding the retrieved values fixes that "exactly two only prints the first" case. I don't know why that is.
Thanks for looking it over.
Switching to vim from Emacs, how do I get basic CEDET-style functionality in vim? I'd like some simple autocomplete but it seems like there's a half dozen plugins that offer that. Any that are actually good?
>People using WPF without even attempting to use any of the available tools to make their lives easier.
If you're not going to do MVVM at least learn to use some of the basic functionality.
You should make it increase in frequency
faggot
could you copy the java code and recompile it and run it or did you have problems?
and if you recompiled it, what did you do to make it work?